Comments (11)
It seems I also need to keep a reference to the Face object when calling hb.Face.create_for_tables(..)
otherwise I get OSError: exception: privileged instruction
when calling hb_shape.
from harfpy.
Still get some access violations after that..
Traceback (most recent call last):
File "c:\users\admin\downloads\trufont\lib\trufont\controls\glyphCanvasView.py", line 342, in keyPressEvent
self._redirectEvent(event, self._currentTool.keyPressEvent)
File "c:\users\admin\downloads\trufont\lib\trufont\controls\glyphCanvasView.py", line 465, in _redirectEvent
callback(event)
File "c:\users\admin\downloads\trufont\lib\trufont\drawingTools\textTool.py", line 123, in keyPressEvent
self.layoutLine.insert(text)
File "c:\users\admin\downloads\trufont\lib\trufont\objects\layoutLine.py", line 100, in insert
self.updateView()
File "c:\users\admin\downloads\trufont\lib\trufont\objects\layoutLine.py", line 170, in updateView
self._shapeAndSetText()
File "c:\users\admin\downloads\trufont\lib\trufont\objects\layoutLine.py", line 149, in _shapeAndSetText
records = self.engine.process(names)
File "c:\users\admin\downloads\trufont\lib\trufont\objects\layoutEngine.py", line 256, in process
hb.shape(self._hbFont, buf, list(self._fontFeatures.values()))
File "c:\users\admin\downloads\harfpy\harfbuzz.py", line 4194, in shape
hb.hb_shape(font._hbobj, buffer._hbobj, c_features, nr_features)
OSError: exception: access violation reading 0xBEE7AE64
cc @khaledhosny
from harfpy.
Ah, apparently storing a reference to the hb.FontFuncs
I use fixes the last access violation.
from harfpy.
In other words, a Font
object needs to keep a reference to the parent Face
?
from harfpy.
I think so in the create_for_tables case which is similar to create_for_array (a reference to the data source should be kept). It can be left to the user, but in that case it should probably be documented.
from harfpy.
hb_font_t
keeps a reference of its hb_face_t
, so I think the Python objects should do something similar.
from harfpy.
sgtm. The Font.face method would then return the cached Face object, this would keep the source data alive.
from harfpy.
OK, I have done this in 99b3562. See if it fixes the problem.
from harfpy.
Thanks. I think the same should be done for FontFuncs, a reference to it should be stored when Font.set_funcs is called.
About my question in the first post, would you know how to use the hb.Blob.create rather than create for array? (see first post)
from harfpy.
There is a subtlety to getting the memory address for bytes
and bytearray
objects. Blob.create_for_array
can now accept these as of 5a887d5 (copying the same code I used in Qahirah, thanks to a tip from Eryk Sun). You can just use that, or you can look at the code to figure out how to do it with Blob.create
for yourself.
from harfpy.
Font.font_funcs
and Buffer.unicode_funcs
now have associated references saved to prevent premature disposal as of e5c5fe0.
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
- 64 scale factor should only apply to FT funcs HOT 12
- Access violation HOT 7
- The signature of python font funcs callbacks is different from C HOT 7
- 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.