Font rendering bigger in cordova canvas than in mobile chromeCSS Layout with Pixel And PercentsjQuery misalignment when using font-faceHow to fix @fontface vs. default font size - layout breaks if @fontface doesn't loadFont missing in wordpressCSS Import Font Issue@font-face fix in IE 9 and above but introduce new issue in IE 8@font-face returns 404s on fontsfont face not working on android chrome and firefoxBitmapText using fabricjsFonts difference between website & Invsion (Designers & Front End developers tool)
What can we do to stop prior company from asking us questions?
Integer addition + constant, is it a group?
What does the word "Atten" mean?
How does it work when somebody invests in my business?
Type int? vs type int
Trouble understanding the speech of overseas colleagues
How does Loki do this?
What is the best translation for "slot" in the context of multiplayer video games?
Applicability of Single Responsibility Principle
Why, precisely, is argon used in neutrino experiments?
How do scammers retract money, while you can’t?
What is the intuitive meaning of having a linear relationship between the logs of two variables?
Why not increase contact surface when reentering the atmosphere?
How did Doctor Strange see the winning outcome in Avengers: Infinity War?
Closest Prime Number
Is expanding the research of a group into machine learning as a PhD student risky?
You cannot touch me, but I can touch you, who am I?
What is the opposite of 'gravitas'?
How to safely derail a train during transit?
How do I find the solutions of the following equation?
Sequence of Tenses: Translating the subjunctive
India just shot down a satellite from the ground. At what altitude range is the resulting debris field?
Why are there no referendums in the US?
How to pronounce the slash sign
Font rendering bigger in cordova canvas than in mobile chrome
CSS Layout with Pixel And PercentsjQuery misalignment when using font-faceHow to fix @fontface vs. default font size - layout breaks if @fontface doesn't loadFont missing in wordpressCSS Import Font Issue@font-face fix in IE 9 and above but introduce new issue in IE 8@font-face returns 404s on fontsfont face not working on android chrome and firefoxBitmapText using fabricjsFonts difference between website & Invsion (Designers & Front End developers tool)
I'm facing a weird issue in my Cordova Application on Android.
I am drawing text to a canvas, like this:
context.textAlign = "center";
context.textBaseline = "middle";
context.font = "5px GameFont";
context.fillText("...", x, y);
However, the font renders bigger in the cordova application (Which uses the same browser view than my mobile chrome):
I'm loading the font via css:
@font-face
font-family: 'GameFont';
font-style: normal;
font-weight: normal;
src: url('fonts/work-sans-v4-latin-600.woff2') format('woff2'),
url('fonts/work-sans-v4-latin-600.woff') format('woff');
Things I tried
Using a default font:
I tried using Arial
and the same issue occurs.
Ensuring the font is preloaded:
<span style="font-family: GameFont;" class="fontPreload">_</span>
Setting/normalizing css text properties:
text-rendering: optimizeLegibility;
font-style: normal;
text-decoration: none;
text-size-adjust: 100%;
letter-spacing: normal;
line-break: auto;
line-height: 1.2;
text-transform: none;
white-space: normal;
word-break: normal;
word-spacing: normal;
word-wrap: break-word;
font-stretch: 100%;
Preloading the font using document.fonts
const font = new FontFace(familyName, "url(" + url + ")", descriptors);
font.load().then(() =>
document.fonts.add(font)
);
Anybody already faced this issue? How can it get solved?
javascript android css cordova fonts
add a comment |
I'm facing a weird issue in my Cordova Application on Android.
I am drawing text to a canvas, like this:
context.textAlign = "center";
context.textBaseline = "middle";
context.font = "5px GameFont";
context.fillText("...", x, y);
However, the font renders bigger in the cordova application (Which uses the same browser view than my mobile chrome):
I'm loading the font via css:
@font-face
font-family: 'GameFont';
font-style: normal;
font-weight: normal;
src: url('fonts/work-sans-v4-latin-600.woff2') format('woff2'),
url('fonts/work-sans-v4-latin-600.woff') format('woff');
Things I tried
Using a default font:
I tried using Arial
and the same issue occurs.
Ensuring the font is preloaded:
<span style="font-family: GameFont;" class="fontPreload">_</span>
Setting/normalizing css text properties:
text-rendering: optimizeLegibility;
font-style: normal;
text-decoration: none;
text-size-adjust: 100%;
letter-spacing: normal;
line-break: auto;
line-height: 1.2;
text-transform: none;
white-space: normal;
word-break: normal;
word-spacing: normal;
word-wrap: break-word;
font-stretch: 100%;
Preloading the font using document.fonts
const font = new FontFace(familyName, "url(" + url + ")", descriptors);
font.load().then(() =>
document.fonts.add(font)
);
Anybody already faced this issue? How can it get solved?
javascript android css cordova fonts
What you should check is the font size setting in Android Setting and see if they make any impact in rendering.
– Gungnir
Mar 8 at 11:09
@Gungnir actually this seems to be the case! Any idea how I could prevent this?
– tobspr
Mar 8 at 11:17
So, after playing arround a bit, it seems that while most of the font is scaled, the canvas drawing is not affected, only the html content. Any other idea?
– tobspr
Mar 8 at 11:41
For a quick "fix" you should try -webkit-text-size-adjust: none; in your css but imo the real fix would be to use font size specified in dp instead of px. Also if you have access to android code you can force your locally loaded webview font size with this: developer.android.com/reference/android/webkit/…
– Gungnir
Mar 8 at 11:58
@Gungnir I already have text-size-adjust in my css and it does not really do anything. I don't think it affects canvas rendering
– tobspr
Mar 8 at 13:55
add a comment |
I'm facing a weird issue in my Cordova Application on Android.
I am drawing text to a canvas, like this:
context.textAlign = "center";
context.textBaseline = "middle";
context.font = "5px GameFont";
context.fillText("...", x, y);
However, the font renders bigger in the cordova application (Which uses the same browser view than my mobile chrome):
I'm loading the font via css:
@font-face
font-family: 'GameFont';
font-style: normal;
font-weight: normal;
src: url('fonts/work-sans-v4-latin-600.woff2') format('woff2'),
url('fonts/work-sans-v4-latin-600.woff') format('woff');
Things I tried
Using a default font:
I tried using Arial
and the same issue occurs.
Ensuring the font is preloaded:
<span style="font-family: GameFont;" class="fontPreload">_</span>
Setting/normalizing css text properties:
text-rendering: optimizeLegibility;
font-style: normal;
text-decoration: none;
text-size-adjust: 100%;
letter-spacing: normal;
line-break: auto;
line-height: 1.2;
text-transform: none;
white-space: normal;
word-break: normal;
word-spacing: normal;
word-wrap: break-word;
font-stretch: 100%;
Preloading the font using document.fonts
const font = new FontFace(familyName, "url(" + url + ")", descriptors);
font.load().then(() =>
document.fonts.add(font)
);
Anybody already faced this issue? How can it get solved?
javascript android css cordova fonts
I'm facing a weird issue in my Cordova Application on Android.
I am drawing text to a canvas, like this:
context.textAlign = "center";
context.textBaseline = "middle";
context.font = "5px GameFont";
context.fillText("...", x, y);
However, the font renders bigger in the cordova application (Which uses the same browser view than my mobile chrome):
I'm loading the font via css:
@font-face
font-family: 'GameFont';
font-style: normal;
font-weight: normal;
src: url('fonts/work-sans-v4-latin-600.woff2') format('woff2'),
url('fonts/work-sans-v4-latin-600.woff') format('woff');
Things I tried
Using a default font:
I tried using Arial
and the same issue occurs.
Ensuring the font is preloaded:
<span style="font-family: GameFont;" class="fontPreload">_</span>
Setting/normalizing css text properties:
text-rendering: optimizeLegibility;
font-style: normal;
text-decoration: none;
text-size-adjust: 100%;
letter-spacing: normal;
line-break: auto;
line-height: 1.2;
text-transform: none;
white-space: normal;
word-break: normal;
word-spacing: normal;
word-wrap: break-word;
font-stretch: 100%;
Preloading the font using document.fonts
const font = new FontFace(familyName, "url(" + url + ")", descriptors);
font.load().then(() =>
document.fonts.add(font)
);
Anybody already faced this issue? How can it get solved?
javascript android css cordova fonts
javascript android css cordova fonts
edited Mar 8 at 11:04
tobspr
asked Mar 8 at 10:55
tobsprtobspr
6,06422139
6,06422139
What you should check is the font size setting in Android Setting and see if they make any impact in rendering.
– Gungnir
Mar 8 at 11:09
@Gungnir actually this seems to be the case! Any idea how I could prevent this?
– tobspr
Mar 8 at 11:17
So, after playing arround a bit, it seems that while most of the font is scaled, the canvas drawing is not affected, only the html content. Any other idea?
– tobspr
Mar 8 at 11:41
For a quick "fix" you should try -webkit-text-size-adjust: none; in your css but imo the real fix would be to use font size specified in dp instead of px. Also if you have access to android code you can force your locally loaded webview font size with this: developer.android.com/reference/android/webkit/…
– Gungnir
Mar 8 at 11:58
@Gungnir I already have text-size-adjust in my css and it does not really do anything. I don't think it affects canvas rendering
– tobspr
Mar 8 at 13:55
add a comment |
What you should check is the font size setting in Android Setting and see if they make any impact in rendering.
– Gungnir
Mar 8 at 11:09
@Gungnir actually this seems to be the case! Any idea how I could prevent this?
– tobspr
Mar 8 at 11:17
So, after playing arround a bit, it seems that while most of the font is scaled, the canvas drawing is not affected, only the html content. Any other idea?
– tobspr
Mar 8 at 11:41
For a quick "fix" you should try -webkit-text-size-adjust: none; in your css but imo the real fix would be to use font size specified in dp instead of px. Also if you have access to android code you can force your locally loaded webview font size with this: developer.android.com/reference/android/webkit/…
– Gungnir
Mar 8 at 11:58
@Gungnir I already have text-size-adjust in my css and it does not really do anything. I don't think it affects canvas rendering
– tobspr
Mar 8 at 13:55
What you should check is the font size setting in Android Setting and see if they make any impact in rendering.
– Gungnir
Mar 8 at 11:09
What you should check is the font size setting in Android Setting and see if they make any impact in rendering.
– Gungnir
Mar 8 at 11:09
@Gungnir actually this seems to be the case! Any idea how I could prevent this?
– tobspr
Mar 8 at 11:17
@Gungnir actually this seems to be the case! Any idea how I could prevent this?
– tobspr
Mar 8 at 11:17
So, after playing arround a bit, it seems that while most of the font is scaled, the canvas drawing is not affected, only the html content. Any other idea?
– tobspr
Mar 8 at 11:41
So, after playing arround a bit, it seems that while most of the font is scaled, the canvas drawing is not affected, only the html content. Any other idea?
– tobspr
Mar 8 at 11:41
For a quick "fix" you should try -webkit-text-size-adjust: none; in your css but imo the real fix would be to use font size specified in dp instead of px. Also if you have access to android code you can force your locally loaded webview font size with this: developer.android.com/reference/android/webkit/…
– Gungnir
Mar 8 at 11:58
For a quick "fix" you should try -webkit-text-size-adjust: none; in your css but imo the real fix would be to use font size specified in dp instead of px. Also if you have access to android code you can force your locally loaded webview font size with this: developer.android.com/reference/android/webkit/…
– Gungnir
Mar 8 at 11:58
@Gungnir I already have text-size-adjust in my css and it does not really do anything. I don't think it affects canvas rendering
– tobspr
Mar 8 at 13:55
@Gungnir I already have text-size-adjust in my css and it does not really do anything. I don't think it affects canvas rendering
– tobspr
Mar 8 at 13:55
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55061718%2ffont-rendering-bigger-in-cordova-canvas-than-in-mobile-chrome%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55061718%2ffont-rendering-bigger-in-cordova-canvas-than-in-mobile-chrome%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
What you should check is the font size setting in Android Setting and see if they make any impact in rendering.
– Gungnir
Mar 8 at 11:09
@Gungnir actually this seems to be the case! Any idea how I could prevent this?
– tobspr
Mar 8 at 11:17
So, after playing arround a bit, it seems that while most of the font is scaled, the canvas drawing is not affected, only the html content. Any other idea?
– tobspr
Mar 8 at 11:41
For a quick "fix" you should try -webkit-text-size-adjust: none; in your css but imo the real fix would be to use font size specified in dp instead of px. Also if you have access to android code you can force your locally loaded webview font size with this: developer.android.com/reference/android/webkit/…
– Gungnir
Mar 8 at 11:58
@Gungnir I already have text-size-adjust in my css and it does not really do anything. I don't think it affects canvas rendering
– tobspr
Mar 8 at 13:55