Comments (12)
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.
Or I guess the Font.scale setter can just call HARFBUZZ.to_position_t()
on the value being set.
from harfpy.
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.
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.
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.
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.
Is this whole autoscale business appropriate at all? Or should I get rid of it?
from harfpy.
Can be removed I think. I'm not using it, I don't use FT funcs.
from harfpy.
I think it is surprising at least, especially if one is familiar with the C API.
from harfpy.
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.
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.
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)
- Which harfbuz shared library version should be used with harfpy? HOT 6
- Proposal: “universal” text shaping result JSON notation based on hb-shape HOT 3
- Could you upload to PyPI? HOT 4
- Porting to OSX HOT 2
- Support for MCUs? HOT 2
- Cannot import the module HOT 1
- 'HARFBUZZ' has no attribute 'message_func_t' HOT 1
- Access violation HOT 7
- The signature of python font funcs callbacks is different from C HOT 7
- Blob from bytes? HOT 11
- Where is main development happening? Github or Gitlab? HOT 1
- segfault on python exit if I don't manually del hb_font instance HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from harfpy.