Or should I say...
ThunderNixon
@ThunderNixon
Best posts made by ThunderNixon
-
RE: Stephen Nixon's blogified class notes: a useful beginners' DrawBot tutorial
@thom After talking with Just, I've learned that RoboFont 2 will use Python 3.6. So, I've updated the
print
statements, and I think those were the only 2.7-specific things. If you spot other issues, though, let me know!
Latest posts made by ThunderNixon
-
RE: Efficient way to convert all text to outlines in a multi-page doc?
Oh, it's probably also worth mentioning the reason I did have to outline text, for anyone who might be Googling this subject.
The printer reported to me that they couldn't place pages from my PDF into InDesign to prep for printing, and that "ripping" the file in Adobe Acrobat also had issues. I'm not quite sure whether this was caused by my variable font (likely) or another logo-specific font I used (also possible).
The warning he reported to me, verbatim, was:
The document could not be saved. Bad font object or font descriptor object.
-
RE: Efficient way to convert all text to outlines in a multi-page doc?
Small update here: even though it took a bit of figuring out to convert text to outlined text, I'm very glad I took that route instead of outputting hi-res bitmaps for the printer.
If the outlines didn't work, the printer said a good backup would be 2400dpi bitmaps (this is an all black-and-white book, and bitmaps would be smaller than JPEGs/PNGs). Even though I'm only making a 3.5-inch (8.89 cm) book, these images were 282.2MB apiece. This meant that generating them was somewhat slow, and also that uploading the 208 images to Dropbox (a total of almost 60 GB) would probably take my internet connection about 20 minutes at 100 Mbps.
I'll share the DrawBot script soon, in case anyone needs it. (If I forget and this is something you do need, please email me: stephen at arrowtype dot com).
-
RE: Efficient way to convert all text to outlines in a multi-page doc?
I did end up going through my document and putting about 10 different types of text into bezier paths.
I know this is the kind of feature that might be a LOT more complex to implement than I realize, but I'd love it if in the future, the
saveImage
function just had an optional "outline text" feature, for needs like this. -
RE: Efficient way to convert all text to outlines in a multi-page doc?
A few notes as I figure things out.
I found that things had to be pretty particular for the Bezier object. I got this error a lot:
Traceback (most recent call last): File "/Users/stephennixon/type-repos/recursive/src/proofs/drawbot-diagrams-etc/flipbook/recursive-flipbook-wave_viz-multistage-visualization_2-outlined_text-081419.drawbot.py", line 481, in <module> showAxisVals("i", italVal, i, infoHeight) File "/Users/stephennixon/type-repos/recursive/src/proofs/drawbot-diagrams-etc/flipbook/recursive-flipbook-wave_viz-multistage-visualization_2-outlined_text-081419.drawbot.py", line 475, in showAxisVals textPath.textBox(valueString,((x,y,w,h)), align="right") File "/usr/local/lib/python3.7/site-packages/drawBot-3.120-py3.7.egg/drawBot/context/baseContext.py", line 340, in textBox self.optimizePath() File "/usr/local/lib/python3.7/site-packages/drawBot-3.120-py3.7.egg/drawBot/context/baseContext.py", line 423, in optimizePath if self._path.elementAtIndex_(count - 1) == AppKit.NSMoveToBezierPathElement: IndexError: NSRangeException - elementAtIndex:associatedPoints:: index (-1) beyond bounds (0)
And found that I needed to work in a specific order:
- to use fontVariations, I had to setup a formatted string
- to make the path with text show up, I had to use
fill
just before thedrawPath
function – it didn't work in the formatted string
txt = FormattedString() txt.font(sans) # MUST be here txt.fontSize(textSize) # MUST be here txt.fontVariations(wght=500, XPRN=xprnVals[0], slnt=0, ital=0) # styling txt.align("right") # styling txt.append("this is my styled string") valueTextPath = BezierPath() fill(foreground) # MUST be here between BezierPath() setup and drawPath(), *not* in formatted string, valueTextPath.textBox(txt,((x,y,w,h))) drawPath(valueTextPath)
-
RE: Efficient way to convert all text to outlines in a multi-page doc?
Ahhh this is very helpful. Thank you!
-
Efficient way to convert all text to outlines in a multi-page doc?
I'm going to be sending a PDF specimen to a printer, but I'm somewhat concerned that the variable fonts I've used might cause problems on their end.
Is there a way to convert an entire document (like, 200 pages of text, mostly not that complex, but complex as a whole) to outlines? I see that BezierPath() might be the answer, but I can't imagine how I'd wrap an entire document in it, if it wasn't something planned from the outset.
My backup is to just export everything to JPEG and bring those into a PDF. Maybe this is just the better option, anyway?
Curious whether there's some option I'm missing. Thanks!
-
Is there a way to build "bleed" into a file, for printing?
I'm making a book via DrawBot, and some of the pages will have a full bleed background color.
Is there any way to add a bleed into a document (aside from changing my whole layout calculation)?
I could imagine there being some kind of technique like this:
W, H = 400, 400 newPage(W,H) bleed = 25 margin = 25 rect(0-bleed,0-bleed,W+bleed*2,H+bleed*2) fill(1) textBox("Content with margin", (margin, margin, W-margin*2, H-margin*2)) saveImage("/Users/stephennixon/Desktop/printready-page.pdf")
However, in a quick test, it doesn't seem like that "beyond the edges" content is carried by the PDF into the Adobe Acrobat
print > marks and bleeds
.If there isn't an "easy way," is there a known way? Do I just add a quarter-inch to all pages (except for along the spine), and then just tell the printer to slice that off?
-
RE: How do I size an image with the ImageObject (or without)?
Ahh this is a very clear-headed approach. Thanks for showing me how it's done! This is very helpful.
-
RE: How do I size an image with the ImageObject (or without)?
I may have found a solution to this, but I'm wondering if there's something more direct.
For now, I'm using
imageObject.size()
to find the image size and set the scale based on my layout:sizingImage = ImageObject(path="img01.jpg") imageScale = W/sizingImage.size()[0] / cols
...then later, using a
savedState()
to apply that scaling inside of a bigger loop:with savedState(): scale(imageScale) image(im, (x* (1/imageScale),y* (1/imageScale)))
If there is (now or in the future) a way to size an image similar to a
rect()
, I would be really excited to learn about it, as it would be quite a bit more direct to use for layouts. Thanks! -
RE: How do I size an image with the ImageObject (or without)?
To add a bit more detail, if I copy the suggested code from the imageObject page but add a path for the optional
path
arg, I get an error message.Error:
Traceback (most recent call last): File "<untitled>", line 10, in <module> File "drawBot/drawBotDrawingTools.pyc", line 265, in size drawBot.misc.DrawBotError: Can't use 'size()' after drawing has begun. Try to move it to the top of your script.
Code:
size(550, 300) # initiate a new image object im = ImageObject("/Users/stephennixon/Downloads/stills/IMG_0769-still-0018.jpg") # draw in the image # the 'with' statement will create a custom context # only drawing in the image object with im: # set a size for the image size(200, 200) # draw something fill(1, 0, 0) rect(0, 0, width(), height()) fill(1) fontSize(30) text("Hello World", (10, 10)) # draw in the image in the main context image(im, (10, 50)) # apply some filters im.gaussianBlur() # get the offset (with a blur this will be negative) x, y = im.offset() # draw in the image in the main context image(im, (300+x, 50+y))
Just to confirm that I am using the correct path, it works fine to use the following code (I just wish I could figure out how to adjust the size).
image("/Users/stephennixon/Downloads/stills/IMG_0769-still-0018.jpg", (10, 50))
Thanks so much for any insights!