Arch Panel Cut : font path difficulties

A forum dedicated to the Draft, Arch and BIM workbenches development.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Post Reply
viralata
Posts: 21
Joined: Thu Feb 05, 2015 10:32 am
Location: France
Contact:

Arch Panel Cut : font path difficulties

Post by viralata »

Hello all (especially Yorik ;) as its about the arch workbench),
I'm still working on my big building model that is composed of hundreds of building parts, mostly panel so therefore hundreds of panel cuts, each one having its own font path that I cant find a way to make relative. As I want others to be able to use the file, I would like to find a way to make a font path relative, or at least an easy way to change all the font paths at once. Is there a workaround for that ?
Thanks
Architect and fabmannager
Blender addict and freecad lover
http://www.viralata.fr
http://www.chantierlibre.org
chrisb
Veteran
Posts: 53935
Joined: Tue Mar 17, 2015 9:14 am

Re: Arch Panel Cut : font path difficulties

Post by chrisb »

viralata wrote: Thu Dec 08, 2022 10:37 am as its about the arch workbench
And so I moved it here.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
User avatar
yorik
Founder
Posts: 13640
Joined: Tue Feb 17, 2009 9:16 pm
Location: Brussels
Contact:

Re: Arch Panel Cut : font path difficulties

Post by yorik »

Unfortunately at the moment I don't see an easy way to do that, other than instructing other users to install the font.. Of course the shapetext tool should support system fonts at some point, but internally it uses the freetype library which only works with paths, and I haven't found a reliable, cross-platform way to convert between a fontname and a font file path.
What you can do in the meantime to at least have all the ShapeText objects to point to a same location, for ex. a spreadsheet cell:
1) create a spreadsheet
2) create a cell with the font path
3) give that cell an alias
4) in each ShapeText, right-click the Font Name property, click "Expression"
5) Give it the name of your cell, something like: Spreadsheet001.MyFontName (the internal, unique name of the spreadsheet you find in the statusbar by hovering it with the mouse, and the MyFontName is the alias name of your cell
6) When you do that, some lines will by printed in the python console. So you can easily make a small script that does it again for all the shapetext objects of your document. Tell me if you need help with that.
User avatar
Roy_043
Veteran
Posts: 8450
Joined: Thu Dec 27, 2018 12:28 pm

Re: Arch Panel Cut : font path difficulties

Post by Roy_043 »

On Windows you can work with relative paths. But the start point of these paths depends on how you start FreeCAD.

For example:
A Document in folder D:\abc\def.
Fonts in folder D:\abc\def\fonts.
Double-click the document to start FreeCAD.
For the "Font File" property of a ShapeString fonts/xyz.ttf can be entered.

If you start FreeCAD from a shortcut the "Start in" folder of the shortcut is the start point of any relative paths.

I do not know if this also works on the other operating systems.
chrisb
Veteran
Posts: 53935
Joined: Tue Mar 17, 2015 9:14 am

Re: Arch Panel Cut : font path difficulties

Post by chrisb »

Roy_043 wrote: Thu Dec 15, 2022 10:00 pm I do not know if this also works on the other operating systems.
It works on macOS too. It's a pity that the font path is not relative to the document path. Then it would be quite natural to place a special font file in the same folder as the document.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
Post Reply