0
votes

I mentioned a problem with custom font's vertical positioning. Following screenshots demonstrate problem very well.

System font:

enter image description hereenter image description here

Custom font (Bitter, downloaded from Google Fonts in .ttf format):

enter image description hereenter image description here

I can observe pretty much the same behaviour with other custom fonts, some of them are more "shifted" to the bottom, some less, however they are never perfectly/correctly centred. I am not actually using underscore font decoration anywhere in the app, however, I have to specify different top and bottom margins for different font sizes to have labels correctly centred.

This issue also causing bottom of label's text everywhere to be cut, for example in letter 'g', 'j', unless I have bottom margin/padding specified. This makes a bit impractical to use custom fonts. Is this some known problem with custom fonts and how can I fix it?

Update:

This issue is reproducible on Simulator ONLY.

1
Is that a custom font added in the designer under the fonts section (which is really a bitmap font) or a TTF set directly to the UIID style? - Shai Almog
They are .ttfs set directly in UIID style. - ruruskyi
I also did a quick test and Bitmap font does not work for me. I chosen 'Serif' which is very similar to 'Bitter'. I'm getting right size but system font gets applied. - ruruskyi
Don't use the bitmap fonts, I asked because you used the term custom font which we use internally for bitmap fonts. Is this an issue only in the simulator or does it happen on the device as well? - Shai Almog
Thanks. I am not using Bitmap fonts (I saw they are deprecated). I checked on target device (iPad mini) and this is an issue with Simulator only. - ruruskyi

1 Answers

0
votes

There are some issues that we are aware of with the font rendering in the Java2D port of Codename One. We aren't sure if these are issues on our end or within Java itself, there is an issue in the tracker about this.