To create text

Post here for help on using FreeCAD's graphical user interface (GUI).
Forum rules
and Helpful information
IMPORTANT: Please click here and read this first, before asking for help

Also, be nice to others! Read the FreeCAD code of conduct!
heda
Veteran
Posts: 1348
Joined: Sat Dec 12, 2015 5:49 pm

Re: To create text

Post by heda »

one user improvement could be to at least make an attempt to search typical font-dirs on the various os's,
or at least raise an infobox or something, that there is no font to make text with, if not a path is provided.

that should be fairly easy to code even for a complete beginner (python in draft, and suppose it's a one liner to raise a infobox in pyside),
so let's see who is the one to pick it up :-).
User avatar
Roy_043
Veteran
Posts: 8409
Joined: Thu Dec 27, 2018 12:28 pm

Re: To create text

Post by Roy_043 »

There is a parameter 'Default ShapeString font file'. IMO we should first check why this does not receive a usable default value.
drmacro
Veteran
Posts: 8806
Joined: Sun Mar 02, 2014 4:35 pm

Re: To create text

Post by drmacro »

Roy_043 wrote: Sun Jun 13, 2021 6:07 pm There is a parameter 'Default ShapeString font file'. IMO we should first check why this does not receive a usable default value.
My first guess it that there is no one font file that can be expected to be resident on all platforms...

But, that is just a guess. :mrgreen:
Star Trek II: The Wrath of Khan: Spock: "...His pattern indicates two-dimensional thinking."
chrisb
Veteran
Posts: 53785
Joined: Tue Mar 17, 2015 9:14 am

Re: To create text

Post by chrisb »

drmacro wrote: Sun Jun 13, 2021 7:31 pm My first guess it that there is no one font file that can be expected to be resident on all platforms...
You are probably right, Courier could be a candidate though. But I think anyway that it would be better to open the file selection box with preselection to fonts if no font file is selected.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
drmacro
Veteran
Posts: 8806
Joined: Sun Mar 02, 2014 4:35 pm

Re: To create text

Post by drmacro »

I agree, some attempt would be nice. I know remembering the path to the font directory is top most in my mind...not. :lol:
Star Trek II: The Wrath of Khan: Spock: "...His pattern indicates two-dimensional thinking."
User avatar
Roy_043
Veteran
Posts: 8409
Joined: Thu Dec 27, 2018 12:28 pm

Re: To create text

Post by Roy_043 »

Qt and Coin do manage to grab fonts from the OS. So technically it is possible. A Draft_Text (Coin based) can be created without specifying a font file for example. From the perspective of the end user it is hard to understand why the same does not apply to Draft_ShapeStrings (not Coin based).
User avatar
Roy_043
Veteran
Posts: 8409
Joined: Thu Dec 27, 2018 12:28 pm

Re: To create text

Post by Roy_043 »

Matplotlib to the rescue?:

Code: Select all

from matplotlib import font_manager
print(font_manager.findfont("Arial"))
print(font_manager.findfont("Sans"))
Note: slow when used for the first time.
snowforest
Posts: 28
Joined: Thu Dec 24, 2020 12:09 pm

Re: To create text

Post by snowforest »

The fonts were at:

C:/WIndows/Fonts

I use the current windows version

I was able to type the text . Thanks
mario52
Veteran
Posts: 4672
Joined: Wed May 16, 2012 2:13 pm

Re: To create text

Post by mario52 »

Hi

if you have problem or difficult tray Macro_Fonts_Win10_PYMP Image just for see or testing

mario
Maybe you need a special feature, go into Macros_recipes and Code_snippets, Topological_data_scripting.
My macros on Gist.github here complete macros Wiki and forum.
Accessdenied
Posts: 39
Joined: Fri Jan 24, 2020 10:11 am

Re: To create text

Post by Accessdenied »

Hi!
I need to extrude the text from the cylinder. Tried to use this instruction: https://www.youtube.com/watch?v=fGCkKdXUBZU
Draft the text, make a projection and then cut it with bolean. But the problem is, that if text is too long, then projection on such cylinder is very deformed, how can I make a text to be projected perpendicularly to the cylinder not like projection from one side?
Post Reply