discuss-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: fonts displaying strangely


From: Fred Kiefer
Subject: Re: fonts displaying strangely
Date: Tue, 01 Nov 2011 22:13:32 +0100
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; de; rv:1.9.2.23) Gecko/20110920 SUSE/3.1.15 Thunderbird/3.1.15

On 31.10.2011 23:39, Eric Wasylishen wrote:
My idea of how to proceed is something like this:
- add a method to NSLayoutManager for getting a range of glyphs and their 
advances as efficiently as possible, which should not be difficult (or maybe we 
already have that?).   I'm not sure if I advertised it well, but I made a 
change in NSLayoutManager several months ago so that we store advancements 
along with the glyphs in the glyph run data structure (previously, the 
advancements were not stored.The reason for this change is so in the future we 
can implement a glyph generator which does complex text layout, by calling a 
library such as harfbuzz or icu, since these take a character run and output a 
glpyh run with advancements.)
- properly implement GSShowGlyphsWithAdvances in the backends. easy for cairo, 
at least.
- for cairo, it would be nice to use real glyphs by importing the code from 
Opal that Neils and I wrote.

Sounds great.
Let us talk in detail how to integrate these two implementations. I think that most of the FreeType code you wrote there would fit perfectly into a FontInfo subclass, but I also remember there was a part that didn't. That is, you did override some code from NSFont, but I am not that sure which bit.

Maybe the best way to start this rewrite is to use a font descriptor in the creation of a FontInfo instead of the font name we currently use. If this descriptor contains a font name everything stays the same for the old backend, if it doesn't they will have to use some methods on NSFontManager to get the font name. We will need two additional flags in the descriptor for the role and whether we want a screen font. The descriptor could be used instead of GSFontMapKey to cache the currently used fonts.

The pseudocode for -drawGlyphsForGlyphRange:atPoint: should look something like 
this:

for the range to be drawn:
        - get the first subrange with the same colour
        - get the glyphs in that subrange and their advances as efficiently as 
possible
        - set the colour, and send the glyphs and advances to the backend with 
GSShowGlyphsWithAdvances
        - start the next loop iteration, starting at the end of the current 
subrange

Again, sounds correct to me.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]