[solved] Shapestring Tracking

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!
chrisb
Veteran
Posts: 52169
Joined: Tue Mar 17, 2015 9:14 am

[solved] Shapestring Tracking

Post by chrisb »

The tracking of a ShapeString is said to be the addisional distance between the characters. I thought until now that this doesn't work but I was wrong, the values I entered where far too small to have any effect. However, I don't understand the meaning of the units and I am unsure how to reliably control it:

I made a test with FreeSans.ttf and entered some text at a height of 10. If I set the tracking to 1000mm (yes, that's one meter while the height of a character is 18mm :o) I get additional spacing of 8.3333 mm. And even worse, if I double the height of the string the additional space is doubled as well. So it is definitely not a distance, but rather a factor, but what is it multiplied with?

Does anyone know more about this?

OS: Ubuntu 14.04.5 LTS
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.17.11379 (Git)
Build type: None
Branch: master
Hash: 654276c49d1b66cf3c2a5ec538629c6d9f77c489
Python version: 2.7.6
Qt version: 4.8.6
Coin version: 4.0.0a
OCC version: 7.1.0
Last edited by chrisb on Mon Jun 26, 2017 10:52 pm, edited 1 time in total.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
User avatar
wandererfan
Veteran
Posts: 5992
Joined: Tue Nov 06, 2012 5:42 pm
Contact:

Re: Shapestring Tracking

Post by wandererfan »

chrisb wrote: Wed Jun 21, 2017 11:30 pm Does anyone know more about this?
This is a bug in FT2FC.cpp. The tracking value needs to be scaled.

From a quick review, 1/64 of a pixel is the "natural unit" in FreeType (the library that understands font definitions) and a pixel's size changes with the font size and device resolution. So tracking needs to be translated into something horrible like font-size-in-points/72 points-per-inch * ??device-dots-per-inch * 64. Plus changing font height in mm into points.

If you make a ticket, I'll try to find time to relearn FreeType and fix it.

wf
chrisb
Veteran
Posts: 52169
Joined: Tue Mar 17, 2015 9:14 am

Re: Shapestring Tracking

Post by chrisb »

Done: issue #3094.
The test file should look like this, if you have the appropriate font. The ShapeStrings are two capital letters "I". I can add a file using the MacOS fonts if needed.
Attachments
Bildschirmfoto 2017-06-22 um 11.55.08.png
Bildschirmfoto 2017-06-22 um 11.55.08.png (65.29 KiB) Viewed 2236 times
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
User avatar
wandererfan
Veteran
Posts: 5992
Joined: Tue Nov 06, 2012 5:42 pm
Contact:

Re: Shapestring Tracking

Post by wandererfan »

This should be fixed by git commit 674aabe8.
Attachments
testWS.png
testWS.png (7.05 KiB) Viewed 2181 times
User avatar
Kunda1
Veteran
Posts: 13443
Joined: Thu Jan 05, 2017 9:03 pm

Re: Shapestring Tracking

Post by Kunda1 »

@chrisb please mark as [Solved]
Thanks WF for the fix!
Alone you go faster. Together we go farther
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
chrisb
Veteran
Posts: 52169
Joined: Tue Mar 17, 2015 9:14 am

Re: [solved] Shapestring Tracking

Post by chrisb »

Thank you very much. Now I will have to revisit all my files containing ShapeStrings if they contain some monstrous tracking values :lol: .
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
User avatar
wandererfan
Veteran
Posts: 5992
Joined: Tue Nov 06, 2012 5:42 pm
Contact:

Re: [solved] Shapestring Tracking

Post by wandererfan »

You're welcome.
User avatar
DeepSOIC
Veteran
Posts: 7900
Joined: Fri Aug 29, 2014 12:45 am
Location: used to be Saint-Petersburg, Russia

Re: [solved] Shapestring Tracking

Post by DeepSOIC »

Hmm, should I teach FCTeleport to do it automatically?
User avatar
sgrogan
Veteran
Posts: 6501
Joined: Wed Oct 22, 2014 5:02 pm

Re: [solved] Shapestring Tracking

Post by sgrogan »

DeepSOIC wrote: Wed Jun 28, 2017 7:51 pm Hmm, should I teach FCTeleport to do it automatically?
Would be interesting to see FCTeleport handle this. Would be a good use case of the POC.
"fight the good fight"
chrisb
Veteran
Posts: 52169
Joined: Tue Mar 17, 2015 9:14 am

Re: [solved] Shapestring Tracking

Post by chrisb »

I wonder if it's worth the effort. As a pure guess I would say that most people who have tried it have entered a value during the creation process. And they have probably forgotten about it, because nothing visible has happened. In the example on the Ubuntu it was a deviation of 8/1000 mm, on the mac it was even less.
Since the ShapeStrings are usually not construction elements with tight fitting or other high precision requirements I would neglect it.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
Post Reply