• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Generating ligature glyphs
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Generating ligature glyphs


  • Subject: Re: Generating ligature glyphs
  • From: Aki Inoue <email@hidden>
  • Date: Fri, 28 Oct 2005 11:32:08 -0700

Rolland,

In Tiger, we added -endLineWithGlyphRange: to NSTypesetter. The invocation of this method at the end of a line layout session "commits" the result.

In other words, you could decide not commit by overriding this method if you found a conflict between the last line fragment and previous ones, and retrace.

My typesetter is working nicely, but I just need to know how to get the
ligatures and their glyphs.
Since the ligature mapping is context dependent, we don't offer simple ligature glyph query. If you really want to go this approach, you need to parse font tables by yourself unfortunately.

Aki

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
  • Follow-Ups:
    • Re: Generating ligature glyphs
      • From: Rolland Bryan <email@hidden>
References: 
 >Re: Generating ligature glyphs (From: Rolland Bryan <email@hidden>)

  • Prev by Date: Re: Any way to copy UI objects with their bindings intact?
  • Next by Date: adjustPageWidthNew
  • Previous by thread: Re: Generating ligature glyphs
  • Next by thread: Re: Generating ligature glyphs
  • Index(es):
    • Date
    • Thread