Giter Club home page Giter Club logo

Comments (12)

khaledhosny avatar khaledhosny commented on August 17, 2024 1

Looks like all glyph positions are divided by 64, but the code that set font scale does not multiply it by 64. I think the division by 64 should be kept only for when FreeType font functions are used (that I assume multiply the font size by 64).

from harfpy.

khaledhosny avatar khaledhosny commented on August 17, 2024

Or I guess the Font.scale setter can just call HARFBUZZ.to_position_t() on the value being set.

from harfpy.

ldo avatar ldo commented on August 17, 2024

I forgot about non-FreeType fonts. Looks like I need to distinguish FreeType and non-FreeType cases. This will have ramifications through the Face, Font and FontFuncs classes.

I may need to make a backward-incompatible change to the API for FontFuncs.

Got to think some more about this.

from harfpy.

ldo avatar ldo commented on August 17, 2024

OK, I have done a change to the Font.scale attribute to be consistent with the other metrics. Here is the output I now get from running your script:

gid43=0@1540,0+0
gid72=1@1260,0+0
gid79=2@569,0+0
gid79=3@569,0+0
gid82=4@1253,0+0
gid3=5@651,0+0
gid58=6@2025,0+0
gid82=7@1253,0+0
gid85=8@842,0+0
gid79=9@569,0+0
gid71=10@1300,0+0
gid4=11@821,0+0

I still plan to make a backward-incompatible API change to allow more control over the metrics scaling.

from harfpy.

ldo avatar ldo commented on August 17, 2024

OK, I have committed in d88fbb2 the necessary reworking of all the handling of metrics. Note the new autoscale setting which is automatically set to True for FreeType faces, and which you now have to specify for non-FreeType ones and for FontFunc objects.

I think this properly solves the problem. Unless I misunderstood something about FreeType fonts...

from harfpy.

adrientetar avatar adrientetar commented on August 17, 2024

and which you now have to specify for non-FreeType ones and for FontFunc objects.

Maybe that argument could have a default value of False?

from harfpy.

ldo avatar ldo commented on August 17, 2024

Is this whole autoscale business appropriate at all? Or should I get rid of it?

from harfpy.

adrientetar avatar adrientetar commented on August 17, 2024

Can be removed I think. I'm not using it, I don't use FT funcs.

from harfpy.

khaledhosny avatar khaledhosny commented on August 17, 2024

I think it is surprising at least, especially if one is familiar with the C API.

from harfpy.

ldo avatar ldo commented on August 17, 2024

The 26.6 scaling is done to be consistent with FreeType. When you call FreeType’s FT_Set_Char_Size, you set the size in 26.6-scaled units. Therefore it makes sense to get back glyph metrics in the same units. This is how a high-level API should work.

I think I will leave the autoscale system as it is.

from harfpy.

adrientetar avatar adrientetar commented on August 17, 2024

But would it be possible to make autoscale constructor args default to False?

Right now I have to pass an additional False argument:

face = hb.Face.create_for_tables(
            _spitLayoutTable, layoutTables, None, False)

funcs = hb.FontFuncs.create(False)

So if Face and Font get their autoscale set to True when created from freetype object, why not make it default to False otherwise?

In FontFuncs, the autoscale argument can be inferred when Font.set_funcs(funcs, ..) is called (if FontFuncs.autoscale is None the font sets its autoscale value to the FontFuncs).

from harfpy.

ldo avatar ldo commented on August 17, 2024

The Font.autoscale and FontFuncs.autoscale settings are independent, and serve different purposes.

In fact, I’ve been thinking whether it might not be useful to generalize to other scale factors besides the shift of 6 used by FreeType.

But maybe I’ll just leave it this way for now.

from harfpy.

Related Issues (13)

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.