[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[ft] vertical positioning of glyphs from BDF fonts
From: |
Ingmar Frank |
Subject: |
[ft] vertical positioning of glyphs from BDF fonts |
Date: |
Wed, 06 Jan 2010 17:25:40 +0100 |
User-agent: |
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.5) Gecko/20091204 Thunderbird/3.0 |
Hello,
currently I am trying to extend our text engine that uses FreeType for
glyph rendering. Up to now we've only used TrueType fonts but we also
want to be able to use bitmap fonts. Specifically, it is necessary to
achieve output that looks the same (or reasonably close) with both kinds
of fonts, in the same application. The setup is the following:
- FreeType version: 2.3.11
- TT-Font: DejaVuSansCondensed.ttf
- bitmap font: BDF, source is the same file as above, converted with
otf2bdf, 72dpi.
When rendering from a TrueType face, our engine currently uses the
scalable font's ascender and descender for vertical positioning. For
printing a line of text at the y position 'screenY', each glyph's y
position is determined by
y = screenY + offset
where offset is calculated from the font's ascender, descender and
internal leading, minus the value 'top' from FTC_SBit_Rec for each glyph.
Then I've played around with the generated BDF font, and the glyphs
themselves look fine (same as when using the TTF file directly). But
positioning the glyphs correctly to match the TTF glyphs' y positions
seems to be impossible because the ascender, descender and y_scale of
the loaded face are zero. That makes sense because according to the
documentation these are only valid for scalable formats. The only other
information I could find in FT_FaceRec is the FT_Bitmap_Size structure,
which only contains the 'height' value which I assume to be calculated
from the values FONT_ASCENT and FONT_DESCENT in the generated BDF file.
In my example case they are 11 and 2, respectively, and the 'height'
value is 13, hence my assumption.
Am I missing something, or is it really not possible to calculate the
same y positions for glyphs on the screen for the two cases? I'd be
grateful for any hints. Please let me know if you need more details.
Kind regards,
Ingmar Frank
- [ft] vertical positioning of glyphs from BDF fonts,
Ingmar Frank <=