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:![Screenshot 2020-12-03 at 17 44 12](https://user-images.githubusercontent.com/44162266/101060258-82717080-358f-11eb-8cd5-465c276fc052.png)
Module:![Screenshot 2020-12-03 at 17 46 23](https://user-images.githubusercontent.com/44162266/101060261-843b3400-358f-11eb-9ca7-df4afeec2da2.png)
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.