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)













1















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):



enter image description here



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?










share|improve this question
























  • 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















1















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):



enter image description here



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?










share|improve this question
























  • 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













1












1








1








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):



enter image description here



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?










share|improve this question
















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):



enter image description here



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






share|improve this question















share|improve this question













share|improve this question




share|improve this question








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

















  • 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












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
);



);













draft saved

draft discarded


















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















draft saved

draft discarded
















































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.




draft saved


draft discarded














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





















































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







Popular posts from this blog

Identity Server 4 is not redirecting to Angular app after login2019 Community Moderator ElectionIdentity Server 4 and dockerIdentityserver implicit flow unauthorized_clientIdentityServer Hybrid Flow - Access Token is null after user successful loginIdentity Server to MVC client : Page Redirect After loginLogin with Steam OpenId(oidc-client-js)Identity Server 4+.NET Core 2.0 + IdentityIdentityServer4 post-login redirect not working in Edge browserCall to IdentityServer4 generates System.NullReferenceException: Object reference not set to an instance of an objectIdentityServer4 without HTTPS not workingHow to get Authorization code from identity server without login form

2005 Ahvaz unrest Contents Background Causes Casualties Aftermath See also References Navigation menue"At Least 10 Are Killed by Bombs in Iran""Iran"Archived"Arab-Iranians in Iran to make April 15 'Day of Fury'"State of Mind, State of Order: Reactions to Ethnic Unrest in the Islamic Republic of Iran.10.1111/j.1754-9469.2008.00028.x"Iran hangs Arab separatists"Iran Overview from ArchivedConstitution of the Islamic Republic of Iran"Tehran puzzled by forged 'riots' letter""Iran and its minorities: Down in the second class""Iran: Handling Of Ahvaz Unrest Could End With Televised Confessions""Bombings Rock Iran Ahead of Election""Five die in Iran ethnic clashes""Iran: Need for restraint as anniversary of unrest in Khuzestan approaches"Archived"Iranian Sunni protesters killed in clashes with security forces"Archived

Can't initialize raids on a new ASUS Prime B360M-A motherboard2019 Community Moderator ElectionSimilar to RAID config yet more like mirroring solution?Can't get motherboard serial numberWhy does the BIOS entry point start with a WBINVD instruction?UEFI performance Asus Maximus V Extreme