Open roberto-arista opened 1 year ago
I am testing the FormattedString.fontFilePath() method with a portion of the first code example of the FormattedString object.
FormattedString.fontFilePath()
FormattedString
If I run this code:
newPage(1000, 200) # create a formatted string txt = FormattedString() # adding some text with some formatting txt.append("hello", font="Helvetica", fontSize=100, fill=(1, 0, 0)) # adding more text txt.append("world", font="Times-Italic", fontSize=50, fill=(0, 1, 0)) # setting a font txt.font("Helvetica-Bold") txt.fontSize(75) txt += "hello again" # drawing the formatted string text(txt, (10, 30)) bounds = textBoxCharacterBounds(txt, (0, 0, width(), height())) for eachBox in bounds: print(eachBox.formattedSubString) print(eachBox.formattedSubString.fontFilePath())
I get the following result:
hello /System/Library/Fonts/Helvetica.ttc world /System/Library/Fonts/Helvetica.ttc hello again /System/Library/Fonts/Helvetica.ttc
while I would expect something like this:
hello /System/Library/Fonts/Helvetica.ttc world /System/Library/Fonts/Times-Italic.ttc hello again /System/Library/Fonts/Helvetica.ttc
I am testing the
FormattedString.fontFilePath()
method with a portion of the first code example of theFormattedString
object.If I run this code:
I get the following result:
while I would expect something like this: