Open jansindl3r opened 3 years ago
Does this happens with all fonts? I cannot reproduce this
import drawBot
import AppKit
appName = AppKit.NSBundle.mainBundle().objectForInfoDictionaryKey_("CFBundleDisplayName")
appName = appName or "terminal"
drawBot.newDrawing()
drawBot.newPage()
txt = drawBot.FormattedString()
txt.fontSize(50)
txt.font("Menlo")
txt += "Afrikola Monospaced"
drawBot.text(txt, (100, 100))
drawBot.saveImage(f"test-{appName}.pdf")
drawBot.endDrawing()
I sometimes would have differing output when the module and application were actually different versions of DrawBot. Could this be the case here?
This was clearly a bug but I haven't had time to look at it and make reproducible. I will share soon
I made a demo and it's happening with any fonts. Line shifts if you run it the first time, then it's ok. If you change parameter of the second call of font to be fonts[0] it happens again, but after another execution it's fine again. There is a pdf showing left text on the first page shifted a bit. Archive.zip
I guess this is probably solved with https://github.com/typemytype/drawbot/pull/421
As I cannot reproduce this anymore:
import drawBot as db
import math
import random
from pathlib import Path
base = Path(__file__).parent
fonts = [
str(base/"formal_hn.otf"),
str(base/"informal_hn.otf"),
str(base/"SourceSerif4-Black.otf")
]
for frame in range(10):
db.newPage()
db.fontSize(100)
db.font(fonts[0])
db.text("Hn", (0, 0))
db.font(fonts[1])
db.text("Hn", (300, 0))
db.font(fonts[2])
db.text("Hn", (600, 0))
import AppKit
appName = AppKit.NSBundle.mainBundle().objectForInfoDictionaryKey_("CFBundleExecutable")
print("App name:", appName)
db.saveImage(f"bug{appName}.pdf")
and both exported pdfs looks the same
Hi, I run my script out of the DrawBot app it gives different result than when I run it as a module. I set font with font function, I give it path to my font as a parameter.
App:
Module:
Running it from app gives also this error
It gives the error only in the first attempt to set the font and it says my font won't be used but it did use it eventualyl. Just the shape, the vertical metrics are somehow wrong.