[HarfBuzz] Core Text backend not supporting font index
Vincent Isambart
vincent.isambart at gmail.com
Wed Sep 10 16:14:45 PDT 2014
On Wednesday, September 10, 2014 at 23:59, Jonathan Kew wrote:
> On 10/9/14 14:58, Vincent Isambart wrote:
> > Hi there,
> >
> > I had compiled HarfBuzz with Core Text support thinking it wouldn’t hurt, but I ended up losing a few hours today because the Core Text backend always loads the first font of a TTC file, ignoring the font index.
> >
> > - Is this a known bug?
> > - Does anyone know a way it could be fixed? I looked at the Core Text and related APIs but couldn’t find anywhere you could specify which font you want to load inside of a TTC.
> > - If this cannot be fixed, would it be possible to have some sort of warning if you try to load a font with a font index > 0 with the Core Text backend, to prevent other people to lose time on this.
>
> It looks to me like in principle, you could use the function
> CTFontManagerRegisterFontsForURL to register all the fonts in a .ttc
> file, and CTFontManagerCreateFontDescriptorsFromURL to create the
> corresponding font descriptors; those descriptors could then be used
> with CTFontCreateWithFontDescriptor to create the CTFontRef.
>
> Would the array returned by CTFontManagerCreateFontDescriptorsFromURL
> match the order of the faces in the .ttc, so that you could look them up
> by index? I have no idea.
>
> (Also, I haven't actually tried to use the CTFontManager APIs mentioned,
> so perhaps there are other complications I've overlooked.)
>
One problem is that the Core Text backend gets the font not as a filename but as a blob of data that it loads using CGFontCreateWithDataProvider.
More information about the HarfBuzz
mailing list