Re: Generating ligature glyphs
Re: Generating ligature glyphs
- Subject: Re: Generating ligature glyphs
- From: Rolland Bryan <email@hidden>
- Date: Fri, 28 Oct 2005 10:04:42 +0200
- Thread-topic: Generating ligature glyphs
Aki,
I am subclassing NSATSTypesetter, and that is what I hoped to do. However,
when one has an NSTextContainer with a geometry that creates a
(non-rectangular) hole across which lines must be laid out, NSATSTypesetter
does not maintain a common baseline across the entire line. Rather it treats
each fragment on each side of the hole as completely independent lines. This
also ends up jumbling up lines and laying fragments on top of one another.
I also thought I could override (void)
willSetLineFragmentRect:(NSRectPointer)lineRect forGlyphRange:
(NSRange)glyphRange usedRect:(NSRectPointer)usedRect baselineOffset:
(float *)baselineOffset;
However, if a later fragment in the line needed a lower baseline, I would
have to somehow retrace my steps, in sync with NSATSTypesetter.
My typesetter is working nicely, but I just need to know how to get the
ligatures and their glyphs.
Rolland
On 10/27/05 10:34 PM, "Aki Inoue" <email@hidden> wrote:
> Rolland,
>
> It would be much much easier just to subclass NSATSTypesetter than to
> write your own engine.
>
> The starting point for you would be to override - (void)
> willSetLineFragmentRect:(NSRectPointer)lineRect forGlyphRange:
> (NSRange)glyphRange usedRect:(NSRectPointer)usedRect baselineOffset:
> (float *)baselineOffset;
>
> Aki
>
>> Thank you for your response.
>>
>> I am writing a typesetter.
>>
>> I use getGlyphsInRange:... to obtain the necessary information to
>> calculate
>> line breaks etc. So my precise question is, how do I use the font
>> information to (a) determine which glyph sequence should be
>> replaced with
>> ligature glyph(s) and (b) to obtain the actual NSGlyph representing
>> the
>> ligature?
>>
>> What determines that f¹ followed by i¹ should be a ligature,
>> and, how does
>> one get the fi¹ ligature glyph to do the replacement?
>>
>> This would probably also answer the question as to how to get the
>> right
>> hyphen glyph. I see that NSATSTypesetter uses the undocumented call
>> hyphenGlyphForLocale: on NSFont.
>>
>> One of the reasons I need to write my own typesetter (in addition
>> to it
>> being really interesting) is that I need different behaviour to the
>> way
>> NSATSTypesetter lays out text on a line interrupted by a shape:
>> NSATSTypesetter treats the left and right sides as independent
>> lines; I want
>> a common baseline and height.
>>
>> Rolland Bryan
>>
>>
>> On 10/26/05 8:00 PM, "Douglas Davidson" <email@hidden> wrote:
>>
>>>
>>> On Oct 26, 2005, at 4:40 AM, Rolland Bryan wrote:
>>>
>>>>
>>>> How does one force NSLayoutManager to generate ligature glyphs?
>>>>
>>>
>>> There are many sorts of ligatures, but for e.g an "fi" ligature,
>>> what will
>>> happen is that during glyph generation, the glyph generator will
>>> generate the
>>> standard "f" and "i" glyphs. During layout, the typesetter will
>>> determine
>>> from font information that an "fi" ligature is available, and then
>>> replace the
>>> "f" glyph with the "fi" ligature glyph and the "i" glyph with a
>>> padding null
>>> glyph. Generation of the ligature happens during layout because
>>> it depends on
>>> the "f" and the "i" actually appearing adjacent to each other on
>>> the same line
>>> of text. The process is controlled to some extent by text
>>> attributes; for
>>> example, NSLigatureAttributeName can be set to 0 to suppress
>>> ligatures of this
>>> sort.
>>>
>>> If you would explain what it is that you are trying to do, and
>>> what you are
>>> seeing, perhaps it would be possible to give more detailed guidance.
>>>
>>> Douglas Davidson
>>>
>>>
>>
>>
>> _______________________________________________
>> Do not post admin requests to the list. They will be ignored.
>> Cocoa-dev mailing list (email@hidden)
>> Help/Unsubscribe/Update your Subscription:
>>
>> This email sent to email@hidden
>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden