Open mic-user opened 5 months ago
Hi @mic-user, you can use the method FontDbB.LoadPathFromDir
, to load a singular font with a name. You can then query for that font name.
Hi @mic-user, you can use the method
FontDbB.LoadPathFromDir
, to load a singular font with a name. You can then query for that font name.
Hey, another questions
FontDB.Query
method.ex.
myfont = FontDB.Query("mycoolfont fallback1 fallback2")
- you can add fallbacks to a font by just listing their names after the font in the
FontDB.Query
method.ex.
myfont = FontDB.Query("mycoolfont fallback1 fallback2")
- yes
That seem working. but need more help that if I wanna use Microsoft Windows default font as fallback as below, how should I do?
FontDB.LoadSystemFonts() #<<-- load stystem fonts FontDB.LoadFromPath('FontA', "x:\Font\A.ttf") FontDB.LoadFromPath('FontB', "x:\Font\B.ttf") font : Font = FontDB.Query("FontA MS-Gothic FontB") #<<-- MS-Gothic part seems not working
text = "hello ✓✔" draw_text_wrapped(canvas=cv, # the canvas to draw on text=text, x=256, y=256, # the position of the text ax=0.5, ay=0.5, # the anchor of the text size=32, # the size of the text width=500, # the width of the text font=font, fill=black, align=TextAlign.Center, stroke=2.0, # the stroke width (optional) stroke_color=rainbow, draw_emojis=True) # the stroke color (optional)
Hi. it is nice package. However, cannot get over the first line that font query.
for example,
FontDB.LoadFromDir("c:\\custom_vari_font_folder\\") font = FontDB.Query( what should I put the name here? file name? or what? )
When setup single font as below, how to map a fallback font? since there is no automatic fallback font mapping.
FontDB.LoadFromPath('test_font', "c:\\custom_vari_font_folder\\test.ttf") font : Font = FontDB.Query("test_font")
The 'LoadFromPath' takes first parameter as a name. Is it support any space included name? Seems does not. How to use/assign space included name with it?
FontDB.LoadFromPath('test font', "c:\\custom_vari_font_folder\\test.ttf") font : Font = FontDB.Query("test font") <<< ERROR