Ubuntu font

69 views
Skip to first unread message

Владимир Побединский

unread,
Dec 7, 2013, 9:37:13 AM12/7/13
to urh...@googlegroups.com

I want show my dark skin (email it to Lasse) and Ubuntu font in editor.

I use Ubuntu-M and Ubuntu-C here.

http://font.ubuntu.com

Chris Friesen

unread,
Dec 7, 2013, 12:35:05 PM12/7/13
to urh...@googlegroups.com
don't know why but i love fonts.  the ubuntu font highlights this issue. https://github.com/urho3d/Urho3D/issues/13  where the vertical centering is off.  

Lasse Öörni

unread,
Dec 7, 2013, 2:05:23 PM12/7/13
to urh...@googlegroups.com
It's a nice looking font, thanks for the heads-up.

Chris, do you have a suggestion what to do about the vertical centering, besides adding an attribute for manual positioning? Currently the font code just trusts the font file for the positioning, and I remember seeing the same issue of differing Y-positioning when I eg. load fonts in OpenOffice and select the text row (so that I see which part of the row is actually occupied by the font)

There *is* a possibility the font Y-positioning math is off, however.

Chris Friesen

unread,
Dec 7, 2013, 7:00:43 PM12/7/13
to urh...@googlegroups.com
I think i found an example of some one setting it automagically.

Here is the code for libGDX


Here are the interesting bits:

ascent = FreeType.toInt(fontMetrics.getAscender());
descent = FreeType.toInt(fontMetrics.getDescender());
lineHeight = FreeType.toInt(fontMetrics.getHeight());
baseLine = data.ascent;
yoffset = flip ? -slot.getBitmapTop() + (int)baseLine : -(glyph.height - slot.getBitmapTop()) - (int)baseLine;

My recommendation is to steal shamelessly from them :)

Lasse Öörni

unread,
Dec 8, 2013, 7:52:20 AM12/8/13
to urh...@googlegroups.com
Thanks, I'll check that. Will possibly check something like CEGUI / MyGUI as well to see what their calculations are.

Lasse Öörni

unread,
Dec 8, 2013, 2:41:26 PM12/8/13
to urh...@googlegroups.com
I couldn't get that libGDX formula to work right, but I borrowed some ideas from MyGUI instead, where they're checking the font's OS/2 header for corrections to the ascender & descender.

Now a LineEdit with Ubuntu font is looking like this (I'm not sure if the changes actually affected anything) and I can't see any significant trouble in centering of the capital letters. The blue text selection shows the actual row height & vertical centering of the characters.


Reply all
Reply to author
Forward
0 new messages