Giter Site home page Giter Site logo

Comments (4)

astiob avatar astiob commented on June 16, 2024

Yet another reason to migrate away from EnumFontFamilies to direct CreateFontIndirect calls for each font request :-( I’ve been wanting to do that for quite a while, but it requires a (desirable) larger rewrite of our fontselect, so I haven’t found the energy to actually do it.

I think this happens because we call CreateFontIndirect with the LOGFONT returned by EnumFontFamilies, which has only one font name—and it’s apparently the family name, seeing as EnumFontFamilies returns a separate field for the full name. And the family name, of course, is the same for both of these fonts, as are all the other parameters contained within LOGFONT, as you point out:

EnumFontFamiliesW:
family: [SF Pro Display] fullname: [SF Pro Display Bold] style: [Bold] charset: [0] weight: [700] ntmFlags: [0x40] FontType: [4] (TrueType)
family: [SF Pro Display] fullname: [SF Pro Display Bold Italic] style: [Bold Italic] charset: [0] weight: [700] ntmFlags: [0x40] FontType: [4] (TrueType)

So the value libass’s EnumFontFamilies callback gives to CreateFontIndirect is the same for both fonts, resulting naturally in the same font.

from libass.

astiob avatar astiob commented on June 16, 2024

A possible solution is to replace the lfFaceName with the elfFullName of the ENUMLOGFONTEXW.

Oh. This sounds interesting. But this is only allowed for TrueType-outline fonts, not for CFF-outline ones. SF Pro Display is indeed a TrueType-outline font (although other affected Apple fonts may not be), but the problem is that our callback can’t know which kind of outlines the font has until it has actually obtained the font!

from libass.

moi15moi avatar moi15moi commented on June 16, 2024

A possible solution is to replace the lfFaceName with the elfFullName of the ENUMLOGFONTEXW.

Oh. This sounds interesting. But this is only allowed for TrueType-outline fonts, not for CFF-outline ones. SF Pro Display is indeed a TrueType-outline font (although other affected Apple fonts may not be), but the problem is that our callback can’t know which kind of outlines the font has until it has actually obtained the font!

Why do you say that? elfFullName represent the postscript name for CFF-outline ones (yes this is a terrible name, but it is GDI...)

from libass.

astiob avatar astiob commented on June 16, 2024

Hang on, derp. CFF-outline fonts just return their PostScript name in the elfFullName field. That’s what causes the difference in the first place. So yeah, we should be able to do that!

from libass.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.