Comments (5)
What is the error you get? Did you check the example with TARGET_MONO
?
from freetype-py.
@rougier What is the error you get? Did you check the example with TARGET_MONO?
bitmap.buffer is None.
I noticed that the program should be modified in this way.
import freetype
face = freetype.Face("mplus-1p-black.ttf")
face.set_char_size( 1500 )
flags = freetype.FT_LOAD_FLAGS['FT_LOAD_RENDER'] | freetype.FT_LOAD_FLAGS['FT_LOAD_MONOCHROME'] | freetype.FT_LOAD_TARGETS['FT_LOAD_TARGET_MONO']
face.load_char('S', flags)
bitmap = face.glyph.bitmap
print(bitmap.buffer) # OK
It certainly works if I fix this way, but since this fact can not be understood by reading freetype-py document, please introduce it in 'samples'. (The above source code will be donated to this project)
from freetype-py.
The Freetype documentation has this paragraph:
"If FT_LOAD_RENDER is also set, the glyph is rendered in the corresponding mode (i.e., the mode that matches the used algorithm best). An exception is FT_LOAD_TARGET_MONO since it implies FT_LOAD_MONOCHROME."
It implies the converse also: if you don't have FT_LOAD_RENDER, bitmap is not generated and you need to call FT_Render_Glyph manually to generate a bitmap.
This is at the bottom of FT_LOAD_TARGET_* 's description.
from freetype-py.
@HinTak I am discussing freetype-py, where freetype has nothing to do with it.
from freetype-py.
from freetype-py.
Related Issues (20)
- [Question] How to decode Face.postscript_name? HOT 26
- About emoji from font file error HOT 9
- libfreetype.so when system == Emscripten HOT 11
- Documentation for get_first_char HOT 3
- FT_Exception: (cannot open resource) HOT 21
- Two-factor identification on PyPi HOT 5
- get_cbox() raise "invalid argument" error HOT 3
- Wrong horizontal character positioning in hello world examples HOT 9
- New release with pyinstaller fix HOT 5
- feature request: expose FreeType's COLRv1 API HOT 6
- Please publish .tar.gz sdist archives
- on exit, freetype/__init__.py", line 1233, in __del__ TypeError: 'NoneType' object is not callable HOT 10
- `segfault` with version `2.4.0` HOT 10
- possible memory leaks and issues during finalizer HOT 1
- `load_char` failed for custom fonts with right input HOT 28
- Pyinstaller cannot import module HOT 5
- AttributeError: module 'freetype' has no attribute 'Face' HOT 2
- Please provide non-bundled wheels HOT 7
- Remove the pyinstaller code if there is any more trouble
- Move freetype-py to Freetype organisation ? HOT 2
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 freetype-py.