Request for more options for text object's FontName.
Forum rules
Be nice to others! Read the FreeCAD code of conduct!
Be nice to others! Read the FreeCAD code of conduct!
-
- Posts: 439
- Joined: Tue Apr 04, 2017 6:06 pm
- Location: SF Bay Area, California
Request for more options for text object's FontName.
Seems like only Arial can be used for a text object's ViewObject.FontName. Can more fonts be added?
Re: Request for more options for text object's FontName.
You can use any font present on your system... Just set the name there instead of Arial..
Re: Request for more options for text object's FontName.
Is tit possible to make a dropdown menu here that shows the presented fonts. I have no clue what fonts are all installed on all/ any of mys system(s).
Not talking about what type fonts were accepted. I can imagine that a few of my \latex fonts are not accepted...
Not talking about what type fonts were accepted. I can imagine that a few of my \latex fonts are not accepted...
Re: Request for more options for text object's FontName.
Yes, that is on my radar for some time. Qt provides that already, we would just need to implement a new property type.Jee-Bee wrote:Is tit possible to make a dropdown menu here that shows the presented fonts.
However, before that I would lie to find a way to unify the different font systems, for ex. Draft ShapeString uses a direct path to a ttf file, and I haven't found a relaiable way yet to convert between ttf file path and font name. Plus, coin also accepts not only font names but families (Arial,Sans Serif,sans) or even styles (Arial:bold). Not too sure yet of how to unify all that...
-
- Posts: 439
- Joined: Tue Apr 04, 2017 6:06 pm
- Location: SF Bay Area, California
Re: Request for more options for text object's FontName.
Thank you Yorik. I must be setting it wrong in script because none of these work:
txt.ViewObject.FontName = "Times Roman" (or "Courier" or "Script", etc)
Also, font styles setting would really be nice to have!
BTW, I am in the Part workbench. How do i find out what fonts work?
txt.ViewObject.FontName = "Times Roman" (or "Courier" or "Script", etc)
Also, font styles setting would really be nice to have!
BTW, I am in the Part workbench. How do i find out what fonts work?
Re: Request for more options for text object's FontName.
We have the type PropertyFont for long time.Yes, that is on my radar for some time. Qt provides that already, we would just need to implement a new property type.
Code: Select all
obj=App.ActiveDocument.addObject("App::FeaturePython")
obj.addProperty("App::PropertyFont","Font")
Re: Request for more options for text object's FontName.
one more feature that was there since the beginning and that you only discover years later
- wandererfan
- Veteran
- Posts: 6321
- Joined: Tue Nov 06, 2012 5:42 pm
- Contact:
Re: Request for more options for text object's FontName.
for X11 (Linux and ?OSX?)yorik wrote:However, before that I would lie to find a way to unify the different font systems, for ex. Draft ShapeString uses a direct path to a ttf file, and I haven't found a relaiable way yet to convert between ttf file path and font name.
Code: Select all
//this:
QString family = QString::fromUtf8("Arial");
QFont font(family);
font.setItalic(true);
...
FT_Face FTFont = font.freetypeFace();
//can replace this:
error = FT_New_Face(FTLib,FontSpec,FaceIndex, &FTFont);
https://stackoverflow.com/questions/167 ... ndle-hfont
https://stackoverflow.com/questions/457 ... old-italic
https://stackoverflow.com/questions/113 ... -c-windows
-
- Posts: 439
- Joined: Tue Apr 04, 2017 6:06 pm
- Location: SF Bay Area, California
Re: Request for more options for text object's FontName.
Thanks wmayer but I get nothing happening when i tried these in the console. How am I suppose to use this?wmayer wrote:We have the type PropertyFont for long time.Yes, that is on my radar for some time. Qt provides that already, we would just need to implement a new property type.The property editor shows a combo box with all the font names.Code: Select all
obj=App.ActiveDocument.addObject("App::FeaturePython") obj.addProperty("App::PropertyFont","Font")
Re: Request for more options for text object's FontName.
Select the object in the Tree view and then in the Data tab of the Property Editor you get a "Font" item which you can click on.Thanks wmayer but I get nothing happening when i tried these in the console. How am I suppose to use this?