Font Kerning in AmigaOS4?

This forum is for general developer support questions.
Post Reply
blmara
Posts: 76
Joined: Thu Jun 23, 2011 9:03 am
Location: Vantaa, Finland

Font Kerning in AmigaOS4?

Post by blmara »

Hi,

I've developed a TrueType font containg some kerning pairs for my music application. The original font editor was TypeSmith but currently High-Logik FontCreator. When I used Text() to output these characters, it seems that the kerning is not applied to the printout, i.e. the character combination 'fp' is not output as close as designed in the editor. Can Text() output kerning or how to proceed here?

Marko
Marko
chris
Posts: 562
Joined: Sat Jun 18, 2011 11:05 am
Contact:

Re: Font Kerning in AmigaOS4?

Post by chris »

blmara wrote:Can Text() output kerning or how to proceed here?
It will definitely work if you plot the glyphs manually, using the kerning information. Text() is not that useful unless you're printing simple text in the system's default charset; I don't think there is any way of making it do kerning.
blmara
Posts: 76
Joined: Thu Jun 23, 2011 9:03 am
Location: Vantaa, Finland

Re: Font Kerning in AmigaOS4?

Post by blmara »

chris wrote:
blmara wrote:Can Text() output kerning or how to proceed here?
It will definitely work if you plot the glyphs manually, using the kerning information. Text() is not that useful unless you're printing simple text in the system's default charset; I don't think there is any way of making it do kerning.
Good to know, thanks. Where could I find the actual kerning information? Do you have code examples?

Marko
Marko
chris
Posts: 562
Joined: Sat Jun 18, 2011 11:05 am
Contact:

Re: Font Kerning in AmigaOS4?

Post by chris »

blmara wrote:Good to know, thanks. Where could I find the actual kerning information? Do you have code examples?
Nothing particularly coherent, but http://git.netsurf-browser.org/netsurf. ... ont.c#n711 is the code NetSurf uses. ami_font_plot_glyph does the actual plotting. This is effectively the character advance in pixels for a kerned pair:

Code: Select all

if(*char2) EObtainInfo(&ofont->olf_EEngine,
        OT_TextKernPair, &kern,
        TAG_END);

   char_advance = (ULONG)(((glyph->glm_Width - kern) * emwidth) / 65536);
Plot the glyphs and advance using that and you're pretty much there.
blmara
Posts: 76
Joined: Thu Jun 23, 2011 9:03 am
Location: Vantaa, Finland

Re: Font Kerning in AmigaOS4?

Post by blmara »

chris wrote: Plot the glyphs and advance using that and you're pretty much there.
Thanks a lot, I look into these!

Marko
Marko
Post Reply