Git Product home page Git Product logo

drawbot's People

Contributors

andyclymer avatar asaumierdemers avatar frankrolf avatar gferreira avatar jenskutilek avatar justvanrossum avatar kontur avatar letterror avatar meyouwe avatar robertjanes avatar roberto-arista avatar schriftgestalt avatar thundernixon avatar typemytype avatar typoman avatar yanone avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

drawbot's Issues

canvas flipped

Hi Frederik,
Just bumped into a weird bug.
Double click the frame border to hide the canvas. Then pull the border back to reveal the canvas. Than my canvas was flipped...
Running the script again will not solve this problem. Close and reopen will.

after some test:
Seems that it has to do with the canvas size. If canvas height is so high that parts of top and bottom are hidden, then this bug will strike...

Is it reproducible on your side?

Best, Thom

Random DrawBot crashes.

Usually after closing a DB window and creating a new one. Happens quite a lot, at least on 10.10.2.

Attempting to switch off default "calt" feature for FormattedString fails, string does not render

In a FormattedString, even when openTypeFeatures are set to None, some features still seem to be activated by default – certainly contextual alternates, not sure what else. (Normal strings also appear to have calt on by default, FWIW.)
I can switch additional features on but have not been able to force this one off, like so:

k = FormattedString()
k.openTypeFeatures(calt=False)

This does not only not switch the calt off, but in fact makes the entire string not render at all.

It would be really nice to have full control over what the glyphs are in the FormattedString and not have CoreText do some kind of magic on it. Do you think there’s any chance the above can be made to work?

ImportError: No module named...

Dear Frederik,
I am trying to import some modules like csv or decimal, but Drawbot doesn't find them. Libraries installed with pip (like reportlab for example) or installed in the site-packages folder with the setup.py procedure work.

I can import csv or decimal using Terminal, Nodebox1 or Robofont scripting panel.
Any suggestion?

Thanks
schermata 2014-02-08 alle 22 52 40

Translate not working o SVG export.

When trying to export artwork to svg translate didn't work. on the preview inside drawbot the pages look good and even if i export to other image format. Just in case here is my code.
Best regards.

canvas = 500
lista = ["Font1","Font2","Font3"]

for i in lista:
    newPage(canvas,canvas)
    font(i)
    fontSize (200)
    lineHeight (150)
    capHeight = fontCapHeight()
    textWidth, textHeight = textSize("Rng")
    translate (canvas/2-textWidth/2, canvas/2-capHeight/2)
    text("Rng", (0,0))
    saveImage("output/thumb.png", multipage=True)
    saveImage("output/thumb.svg", multipage=True)

formattedText set fill to None

Traceback (most recent call last):
File "/Users/frederik/Library/Application Support/RoboFont/plugins/DrawBot.roboFontExt/lib/drawBotController.py", line 173, in createContext
_drawBotDrawingTool._drawInContext(context)
File "/Users/frederik/Library/Application Support/RoboFont/plugins/DrawBot.roboFontExt/lib/drawBot/drawBotDrawingTools.py", line 100, in _drawInContext
attr(_args, *_kwargs)
File "/Users/frederik/Library/Application Support/RoboFont/plugins/DrawBot.roboFontExt/lib/drawBot/context/baseContext.py", line 1592, in textBox
self._textBox(txt, (x, y, w, h), align)
File "/Users/frederik/Library/Application Support/RoboFont/plugins/DrawBot.roboFontExt/lib/drawBot/context/pdfContext.py", line 178, in _textBox
self._pdfFillColor(fillColor)
File "/Users/frederik/Library/Application Support/RoboFont/plugins/DrawBot.roboFontExt/lib/drawBot/context/pdfContext.py", line 276, in _pdfFillColor
cgColor = self._nsColorToCGColor(c)
File "/Users/frederik/Library/Application Support/RoboFont/plugins/DrawBot.roboFontExt/lib/drawBot/context/pdfContext.py", line 328, in _nsColorToCGColor
if c.numberOfComponents() == 5:
AttributeError: 'NSNull' object has no attribute 'numberOfComponents'

Module xmlWriter missing

When using drawbot as a module (import drawBot) I got this error:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "drawBot/__init__.py", line 1, in <module>
    from drawBotDrawingTools import _drawBotDrawingTool
  File "drawBot/drawBotDrawingTools.py", line 9, in <module>
    from context import getContextForFileExt
  File "drawBot/context/__init__.py", line 4, in <module>
    from svgContext import SVGContext
  File "drawBot/context/svgContext.py", line 8, in <module>
    from xmlWriter import XMLWriter
ImportError: No module named xmlWriter

Where do I get the xmlWriter? It does not seem to be in PyPI or pre-installed with Python. I am using Python 2.7.10.

textBox returns wrong overflowing text when hyphenation is on

Using for example this code:

size(250,100)
txt = FormattedString()
leftM = bottomM = topM = rightM = 20
boxW = width()-leftM-rightM
boxH = height()-topM-bottomM

hyphenation(True)

txt.append("De wikipedia definitie van een gereedschap is als volgt: Een gereedschap is een hulpmiddel om de bewerking uit te kunnen voeren die een mens (of dier) met zijn lichaam zelf niet of moeilijk kan uitvoeren.", font="Helvetica", fontSize=20)

flow = textBox(txt, (leftM, bottomM, boxW, boxH))
print flow, "\n"
while(flow):
    newPage()
    flow = textBox(flow, (leftM, bottomM, boxW, boxH))
    print flow, "\n"

Text is missing when hyphenation tries to hyphenate a word ('kunnen voeren' in this case)

/path/to/font.otf

Hello, I more of a question than an issue:

font("/path/to/font.otf") is great, but is it also possible to get it feature working in BezierPath().text(font="path")?

:)

Best, Thom

formattedString.lineHeight is not consistent.

I noticed that setting the line height for a formatted string will do something, but not necessarily what I expect. Especially if there is more than one font, the line heights are all different:

doc_height, doc_width = sizes()['Letter']
newPage(doc_width, doc_height)

fill(0)
stroke(None)
margin = 30
textBoxSize = (margin,margin,doc_width-2 * margin,doc_height-2 * margin)
text = 'abcdefghijklmnopqrstuvwxyz\n'

fontSize = 40
lineHeight = fontSize * 1.2
fs = FormattedString()
fs.fontSize(fontSize)
fs.lineHeight(lineHeight)

lineNumber = 0

for font in installedFonts():
    fs.append(text, font=font)
    rect(margin, doc_height - margin - (lineHeight * lineNumber), doc_width - 2 * margin, 0.2)
    lineNumber += 1

maxLineNumber = lineNumber
overflow = textBox(fs, textBoxSize)

while len(unicode(overflow)) > 0:
    newPage(doc_width, doc_height)
    overflow = textBox(overflow, textBoxSize)
    for lineNumber in range(0, maxLineNumber):
        rect(margin, doc_height - margin - (lineHeight * lineNumber), doc_width - 2 * margin, 0.2)

Font caching?

I wrote to Erik about this yesterday, but figured I'd post it here too. I'm running into what appears to be a font caching problem.

Script in question (adapted from Erik's sample script):
`
path = PATH_TO_OTF
fontName = installFont(path)
size(1000, 1000)

thisFontSize = 242
s = FormattedString(
txt="fe AV,",
font="",
fontSize=312,
)
textBox(s , (50, 50, width()-50, height()-1.5*50))
uninstallFont(path)
`

To repro:

  1. Open any font editor and generate an OTF.
  2. Replace the PATH_TO_OTF above with the path to the OTF.
  3. Run the script.
  4. Edit the font, increasing kerning between A and V by 200 and regenerate the OTF.
  5. Run the script.
  6. Note that nothing has changed in the viewport
  7. Close Drawbot.
  8. Reopen Drawbot.
  9. Run script.
  10. Note that the kern change performed in step 4 is now visible

Similarly, instead of closing and reopening drawbot, change the font being used from the non-installed font to something like Helvetica. Run the script once, then change it back. The changes will be visible.

My guess is that there is some font caching going on and Drawbot does not re-load the font each time the script is run. It could also be that I'm not uninstalling the font properly.

Freezing after longer operations

Sometimes when i run a script and it runs for about 20-30 seconds, the program freezes.
This is not happening every time i run it but i know that it's doing its job because i have my gif generated every time. It's just the drawbot that freezes.

Also is it possible to add something like a progress bar? The beachball is quite unsettling.

v3.84
OS 10.11.5

Cursor disappears, adds interesting guessing element to editing

OSX Yosemite, 10.10.5 (14F1808), Version 3.82 (3.82)

Not sure if this is related, but this prints to console:
13/07/16 22:19:47,997 DrawBot[90918]: CGContextSetStrokeColorWithColor: invalid context 0x0. This is a serious error. This application, or a library it uses, is using an invalid context and is thereby contributing to an overall degradation of system stability and reliability. This notice is a courtesy: please fix this problem. It will become a fatal error in an upcoming update.

TypeError: object of type 'NoneType' has no len()

Got this while executing DB-compare-glyphs.py:
https://github.com/loicsander/Font2PDF/blob/master/DrawBot/DB-compare-glyphs.py
On the saveImage() call at the last line.

*** DrawBot warning: font:  is not installed, back to the fallback font: LucidaGrande ***
Traceback (most recent call last):
  File "<untitled>", line 207, in <module>
TypeError: coercing to Unicode: need string or buffer, NoneType found
Traceback (most recent call last):
  File "drawBot/ui/drawBotController.pyc", line 109, in createContext
  File "drawBot/drawBotDrawingTools.pyc", line 61, in _drawInContext
  File "drawBot/context/baseContext.pyc", line 1118, in textBox
  File "drawBot/context/pdfContext.pyc", line 128, in _textBox
TypeError: object of type 'NoneType' has no len()

textBox alignment with FormatttedString

In this example, I would my FormattedString expect to be in the center, but it isn’t:

page_format = 'LetterLandscape'
newPage(page_format)
page_width, page_height = sizes()[page_format]

fs = FormattedString('Hello Beautiful')
textBox(fs, (0, 0, page_width, page_height), align='center')

I know you can center the string by using align='center' in the FormattedString itself, but I wonder why it shouldn’t work the other way around.

Slightly related – could there be an option for vertical centering in a Text Box?

DrawBot v3.85 as Module gives Error during import

Hi there :)

I installed the current version (3.85) as a module and this was the Output in terminal:

drawbot$     python setupAsModule.py install
*** Warning: drawBot requires FontTools, see:
    https://github.com/behdad/fonttools
2016-10-09 18:37:55.300 Python[5108:453688] Error loading /Library/Python/2.7/site-packages/vanilla/externalFrameworks/RBSplitView/RBSplitView.framework/RBSplitView:  dlopen(/Library/Python/2.7/site-packages/vanilla/externalFrameworks/RBSplitView/RBSplitView.framework/RBSplitView, 265): no suitable image found.  Did find:
    /Library/Python/2.7/site-packages/vanilla/externalFrameworks/RBSplitView/RBSplitView.framework/RBSplitView: file too short
running install
running build
running build_py
creating build
creating build/lib
creating build/lib/drawBot
copying drawBot/__init__.py -> build/lib/drawBot
copying drawBot/drawBotDrawingTools.py -> build/lib/drawBot
copying drawBot/misc.py -> build/lib/drawBot
copying drawBot/scriptTools.py -> build/lib/drawBot
copying drawBot/updater.py -> build/lib/drawBot
creating build/lib/drawBot/context
copying drawBot/context/__init__.py -> build/lib/drawBot/context
copying drawBot/context/baseContext.py -> build/lib/drawBot/context
copying drawBot/context/drawBotContext.py -> build/lib/drawBot/context
copying drawBot/context/dummyContext.py -> build/lib/drawBot/context
copying drawBot/context/gifContext.py -> build/lib/drawBot/context
copying drawBot/context/imageContext.py -> build/lib/drawBot/context
copying drawBot/context/movContext.py -> build/lib/drawBot/context
copying drawBot/context/pdfContext.py -> build/lib/drawBot/context
copying drawBot/context/printContext.py -> build/lib/drawBot/context
copying drawBot/context/svgContext.py -> build/lib/drawBot/context
creating build/lib/drawBot/context/tools
copying drawBot/context/tools/__init__.py -> build/lib/drawBot/context/tools
copying drawBot/context/tools/gifTools.py -> build/lib/drawBot/context/tools
copying drawBot/context/tools/imageObject.py -> build/lib/drawBot/context/tools
copying drawBot/context/tools/openType.py -> build/lib/drawBot/context/tools
creating build/lib/drawBot/ui
copying drawBot/ui/__init__.py -> build/lib/drawBot/ui
copying drawBot/ui/codeEditor.py -> build/lib/drawBot/ui
copying drawBot/ui/debug.py -> build/lib/drawBot/ui
copying drawBot/ui/drawBotController.py -> build/lib/drawBot/ui
copying drawBot/ui/drawView.py -> build/lib/drawBot/ui
copying drawBot/ui/lineNumberRulerView.py -> build/lib/drawBot/ui
copying drawBot/ui/preferencesController.py -> build/lib/drawBot/ui
copying drawBot/ui/splitView.py -> build/lib/drawBot/ui
running install_lib
creating /usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/drawBot
copying build/lib/drawBot/__init__.py -> /usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/drawBot
creating /usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/drawBot/context
copying build/lib/drawBot/context/__init__.py -> /usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/drawBot/context
copying build/lib/drawBot/context/baseContext.py -> /usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/drawBot/context
copying build/lib/drawBot/context/drawBotContext.py -> /usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/drawBot/context
copying build/lib/drawBot/context/dummyContext.py -> /usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/drawBot/context
copying build/lib/drawBot/context/gifContext.py -> /usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/drawBot/context
copying build/lib/drawBot/context/imageContext.py -> /usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/drawBot/context
copying build/lib/drawBot/context/movContext.py -> /usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/drawBot/context
copying build/lib/drawBot/context/pdfContext.py -> /usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/drawBot/context
copying build/lib/drawBot/context/printContext.py -> /usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/drawBot/context
copying build/lib/drawBot/context/svgContext.py -> /usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/drawBot/context
creating /usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/drawBot/context/tools
copying build/lib/drawBot/context/tools/__init__.py -> /usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/drawBot/context/tools
copying build/lib/drawBot/context/tools/gifTools.py -> /usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/drawBot/context/tools
copying build/lib/drawBot/context/tools/imageObject.py -> /usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/drawBot/context/tools
copying build/lib/drawBot/context/tools/openType.py -> /usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/drawBot/context/tools
copying build/lib/drawBot/drawBotDrawingTools.py -> /usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/drawBot
copying build/lib/drawBot/misc.py -> /usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/drawBot
copying build/lib/drawBot/scriptTools.py -> /usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/drawBot
creating /usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/drawBot/ui
copying build/lib/drawBot/ui/__init__.py -> /usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/drawBot/ui
copying build/lib/drawBot/ui/codeEditor.py -> /usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/drawBot/ui
copying build/lib/drawBot/ui/debug.py -> /usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/drawBot/ui
copying build/lib/drawBot/ui/drawBotController.py -> /usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/drawBot/ui
copying build/lib/drawBot/ui/drawView.py -> /usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/drawBot/ui
copying build/lib/drawBot/ui/lineNumberRulerView.py -> /usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/drawBot/ui
copying build/lib/drawBot/ui/preferencesController.py -> /usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/drawBot/ui
copying build/lib/drawBot/ui/splitView.py -> /usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/drawBot/ui
copying build/lib/drawBot/updater.py -> /usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/drawBot
byte-compiling /usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/drawBot/__init__.py to __init__.pyc
byte-compiling /usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/drawBot/context/__init__.py to __init__.pyc
byte-compiling /usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/drawBot/context/baseContext.py to baseContext.pyc
byte-compiling /usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/drawBot/context/drawBotContext.py to drawBotContext.pyc
byte-compiling /usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/drawBot/context/dummyContext.py to dummyContext.pyc
byte-compiling /usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/drawBot/context/gifContext.py to gifContext.pyc
byte-compiling /usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/drawBot/context/imageContext.py to imageContext.pyc
byte-compiling /usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/drawBot/context/movContext.py to movContext.pyc
byte-compiling /usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/drawBot/context/pdfContext.py to pdfContext.pyc
byte-compiling /usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/drawBot/context/printContext.py to printContext.pyc
byte-compiling /usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/drawBot/context/svgContext.py to svgContext.pyc
byte-compiling /usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/drawBot/context/tools/__init__.py to __init__.pyc
byte-compiling /usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/drawBot/context/tools/gifTools.py to gifTools.pyc
byte-compiling /usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/drawBot/context/tools/imageObject.py to imageObject.pyc
byte-compiling /usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/drawBot/context/tools/openType.py to openType.pyc
byte-compiling /usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/drawBot/drawBotDrawingTools.py to drawBotDrawingTools.pyc
byte-compiling /usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/drawBot/misc.py to misc.pyc
byte-compiling /usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/drawBot/scriptTools.py to scriptTools.pyc
byte-compiling /usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/drawBot/ui/__init__.py to __init__.pyc
byte-compiling /usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/drawBot/ui/codeEditor.py to codeEditor.pyc
byte-compiling /usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/drawBot/ui/debug.py to debug.pyc
byte-compiling /usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/drawBot/ui/drawBotController.py to drawBotController.pyc
byte-compiling /usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/drawBot/ui/drawView.py to drawView.pyc
byte-compiling /usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/drawBot/ui/lineNumberRulerView.py to lineNumberRulerView.pyc
byte-compiling /usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/drawBot/ui/preferencesController.py to preferencesController.pyc
byte-compiling /usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/drawBot/ui/splitView.py to splitView.pyc
byte-compiling /usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/drawBot/updater.py to updater.pyc
running install_egg_info
Writing /usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/drawBot-3.85-py2.7.egg-info

The OS version is 10.11.6 (El Capitan) and I I've already used it before (probably not on this os) as a module but this time it gave me this error after I tried to import drawBot:

2016-10-09 18:38:29.853 Python[5122:454328] Error loading /Library/Python/2.7/site-packages/vanilla/externalFrameworks/RBSplitView/RBSplitView.framework/RBSplitView:  dlopen(/Library/Python/2.7/site-packages/vanilla/externalFrameworks/RBSplitView/RBSplitView.framework/RBSplitView, 265): no suitable image found.  Did find:
    /Library/Python/2.7/site-packages/vanilla/externalFrameworks/RBSplitView/RBSplitView.framework/RBSplitView: file too short
Traceback (most recent call last):
  File "/Users/user/Desktop/temp.py", line 1, in <module>
    import drawBot
  File "/usr/local/lib/python2.7/site-packages/drawBot/__init__.py", line 1, in <module>
    from drawBotDrawingTools import _drawBotDrawingTool
  File "/usr/local/lib/python2.7/site-packages/drawBot/drawBotDrawingTools.py", line 9, in <module>
    from context import getContextForFileExt
  File "/usr/local/lib/python2.7/site-packages/drawBot/context/__init__.py", line 4, in <module>
    from svgContext import SVGContext
  File "/usr/local/lib/python2.7/site-packages/drawBot/context/svgContext.py", line 8, in <module>
    from xmlWriter import XMLWriter
ImportError: No module named xmlWriter
[Finished in 1.9s with exit code 1]

I'm not sure how to fix it. Is it clear to you what is going on?

Thank you

Variable() buttons

Hey! I love using the Variable() function for setting up quick UIs. I was wondering if it was possible to have a button in my Variable()-based UI that has a callback? I get a traceback for overwriting existing argument.

def doSomething(sender):
    print 'done'

Variable([
            dict(name='MyButton', ui="Button", 
            args=dict( 
                callback=doSomething,
                )
            )
        ],
        globals())

I get this traceback because the argument is already used:

TypeError: type object got multiple values for keyword argument 'callback'

I realize that because drawbot is constantly regenerating the canvas, a button with a callback is functionally no different than a checkbox with an if statement. But UI-wise it makes more sense, and for some button-y things ("Generate UFO" for instance) where I don't necessarily require the canvas to be redrawn.

As an aside, I was also going to try and see if I could implement a Variable() spin-off that only regenerates the canvas when an "OK" button is pressed. Or at that point do you think it is easier to build my own Vanilla UI, and somehow connect it to drawbot?

Thank you for whatever ideas you may have!

Handling more than one document

Hi!
Is there a possibility to handle and save different pdf documents during a script?
I am looking for something like:

### Vars
documents_amount = 10
pages_amount_each_document = 20

### Instructions
for i in range(documents_amount):

    newDocument()

    for i_page in range(pages_each_document):
        newPage()
        doGraphicStuff()

    saveImage('whatever_%#02d.pdf' % i)

in order to have this kind of output:

whatever_00.pdf
whatever_01.pdf
whatever_02.pdf
whatever_03.pdf
whatever_04.pdf
whatever_05.pdf
whatever_06.pdf
whatever_07.pdf
whatever_08.pdf
whatever_09.pdf

every pdf only with 20 pages.

Now I am saving every page separately and then I merge them with pyPdf, but since I need to let this script in other hands, dealing with an external module could be problematic.

Thanks!

textSize with unicode

as @ninastoessinger reported:

testLetters = ["a", "ä"]
font("EamesCenturyModern-Light")
fontSize(120)

for letter in testLetters:
    sizeNeeded = textSize(letter)
    print sizeNeeded

# returns:
# (63.12, 121.0)
# (179.2575, 121.0)

textSize returns the wrong value when a unicode string is provided as a str.

maybe DrawBot must force all strings to unicode?
as this already happens for setting text https://github.com/typemytype/drawbot/blob/master/drawBot/drawBotDrawingTools.py#L924-L927

and add a proper except UnicodeEncodeError
--> added in 169435f

Formatted string issue in latest release

Not sure what changed or if I'm doing something wrong, but FYI my scripts with formatted strings in them stopped working after I updated to 3.72 (using the auto-updater).

An example:

f = FormattedString('asdf', font='Verdana')
textBox(f, (0, 0, width(), height()))

Traceback:

Traceback (most recent call last):
File "", line 2, in
File "drawBot/drawBotDrawingTools.pyc", line 958, in textBox
AttributeError: 'FormattedString' object has no attribute 'decode'

Thanks!

No more animated gifs

saveImage a multi page document as .gif was an animated gif.
I am no longer able to do so...

PDF header

when importing DrawBot and generating a PDF, I'm getting an error after an update;

failed to find PDF header:%PDF' not found.`

as a warning, but second PDF won't build with this error:

It is advised to use 'size()' at the top of a script

Is this a new issue or am I doing something wrong?

Stroke color for text follows fill color, happily ignores custom color.

I noticed that text can no longer be stroked in a custom color:

newPage(1000, 1000)
fill(0.5)
stroke(1,0,1)
strokeWidth(100)
fontSize(666)
font("HelveticaNeue-Bold")

text('HA', (20, 20))
rect(600, 700, 200, 200)

Expected:
Text has pink stroke

What is actually happening:
Text has grey stroke (same as fill color)

MacOS Sierra things

  • thumbnailsView seems not to work
  • pdfView does not take user input like cmd + cmd - or right mouse down

(Probably bugs in the OS)

textSize and center alignment offset by tracking

In v3.68, I am using tracking() along with textSize() and textBox(align="center"). In both cases, it pads the right side of the text with tracking, resulting in a textSize() width that is wider than the actual text, and a centered textBox that isn't actually centered.

Attached is a simple script that shows what I am talking about.

drawBotTracking.py.zip

Is it possible (or desirable) to adjust these so that they measure the right side without the additional tracking? Thanks!

TextBox alignment

Hello!
I'm trying to justify some letters in a textBox. But the last line never makes it to the end of the textBox.

letters = "ABCDEFGHIJKLM NOPQRSTUVWXYZ"
x = 44
y = 600
w = 500
h = 200
fontSize(40)
overflow = textBox(letters, (x,y,w,h), align="justified")

I experimented quite a few thing with this but no success.
It is a bug? Or is there a secret trick?

:) Thom

Color questions on ColorCombinations.py by Nina Stössinger

Using Nina's ColorCombinations.py script to generate combos for a project. I took the RGB values from the InDesign file [Color Settings: Adobe RGB (1998)] to work with in DrawBot.
The result in DB is very different, rather greyish and shady. The screenshot shows the InD file and the DB window.
screen shot 2015-04-10 at 1 31 56 pm

Generating pdfs from DB and InD (with no color conversion) and opened them in Preview also shows differences in colors.
screen shot 2015-04-10 at 2 16 12 pm

What would be the solution for this issue? Thanks!

size() doesn't honour transform()

I tried to crop my canvas but it seems this is not the way?

example:

rect(100,200,300,400)
translate(100,200)
size(300,400)

The result is cropped from the original origin. Not the one set in line 2.

I know there is an advice to use size() on the top of the script, but I what if you don't know where something will be drawn?
I have some scripts where (randomly) things are drawn. The script keeps track of the minimum-x, minimum-y, max-x and max-y. Later I want to crop the canvas and/or expand it, to fit it all nicely...

Any ideas?

Thanks, Thom

Switch between open windows

In OS X apps you can switch between the open windows with the shortcut cmd + `. This doesn't work on Drawbot, I think it's very handy shortcut.

embed installed fonts in a svg context

use:

<defs>
  <style type="text/css">
    @font-face {
      font-family: Delicious;
      src: url('../fonts/font.woff');
      src: url("data:application/font-woff;charset=utf-8;base64,...");
    }
  </style>
</defs>

use url when it is an url or base64 when it is a local file

Fill and Stroke issue in text rendering

Hi!

I am trying to render some text with different colors in "fill" and "stroke".
Something isn't working.

This is the code:

fill(1, 0, 0, .5)
stroke(0,0,1,1)
strokeWidth(5)

fontSize(200)
text('hello', (100,100))

this is the resulting image in Drawbot
schermata 2014-04-10 alle 16 19 22

and this is the splitting of the two overlaid texts from the pdf opened in Illustrator
schermata 2014-04-10 alle 16 14 21

As you can see, the color parameters of the two object are identical, but the assignment in code is different.

Any idea?
Thank you!

ScreenSize as papersize

You have a nice collection of pre-programmed paper sizes.
I use pretty often the size of my screen. Like so:
size(AppKit.NSScreen.mainScreen().frame().size.width, AppKit.NSScreen.mainScreen().frame().size.height)
Wouldn't it be nice to pre-program this into: size("screen")?

:)

Can AppKit handle multiple screens?

nothing in 10.12

The app launches fine but opening scripts or creating new one is instant death.
:)

Exception Name: OC_PythonException
Description: <type 'exceptions.AttributeError'>: 'NoneType' object has no attribute 'enclosingScrollView'
User Info: {
    "__pyobjc_exc_traceback__" = "<traceback object at 0x10f000680>";
    "__pyobjc_exc_type__" = "<type 'exceptions.AttributeError'>";
    "__pyobjc_exc_value__" = "AttributeError(\"'NoneType' object has no attribute 'enclosingScrollView'\",)";
}

0   CoreFoundation                      0x00007fff8f17252b __exceptionPreprocess + 171
1   libobjc.A.dylib                     0x00007fffa384acad objc_exception_throw + 48
2   CoreFoundation                      0x00007fff8f172479 -[NSException raise] + 9
3   _objc.so                            0x0000000106c4fa8b PyObjCErr_ToObjCWithGILState + 46
4   _objc.so                            0x0000000106c3c52d PyObjCFFI_MakeClosure + 5097
5   libffi.dylib                        0x00007fffa3189a2a ffi_closure_unix64_inner + 502
6   libffi.dylib                        0x00007fffa318909e ffi_closure_unix64 + 70
7   AppKit                              0x00007fff8cd88542 -[NSDocumentController newDocument:] + 44
8   libsystem_trace.dylib               0x00007fffa435a03d _os_activity_initiate + 61
9   AppKit                              0x00007fff8d4924e7 -[NSApplication(NSResponder) sendAction:to:from:] + 456
10  AppKit                              0x00007fff8cfd0de2 -[NSMenuItem _corePerformAction] + 324
11  AppKit                              0x00007fff8cfd0b4e -[NSCarbonMenuImpl performActionWithHighlightingForItemAtIndex:] + 114
12  libsystem_trace.dylib               0x00007fffa435a03d _os_activity_initiate + 61
13  AppKit                              0x00007fff8d059b99 -[NSMenu performActionForItemAtIndex:] + 121
14  AppKit                              0x00007fff8d059b10 -[NSMenu _internalPerformActionForItemAtIndex:] + 94
15  AppKit                              0x00007fff8d05993d -[NSCarbonMenuImpl _carbonCommandProcessEvent:handlerCallRef:] + 107
16  AppKit                              0x00007fff8cf102ac NSSLMMenuEventHandler + 986
17  HIToolbox                           0x00007fff8e6620d5 _ZL23DispatchEventToHandlersP14EventTargetRecP14OpaqueEventRefP14HandlerCallRec + 1708
18  HIToolbox                           0x00007fff8e661346 _ZL30SendEventToEventTargetInternalP14OpaqueEventRefP20OpaqueEventTargetRefP14HandlerCallRec + 428
19  HIToolbox                           0x00007fff8e676dc4 SendEventToEventTarget + 40
20  HIToolbox                           0x00007fff8e6c2c96 _ZL18SendHICommandEventjPK9HICommandjjhPKvP20OpaqueEventTargetRefS5_PP14OpaqueEventRef + 411
21  HIToolbox                           0x00007fff8e6ee2bb SendMenuCommandWithContextAndModifiers + 59
22  HIToolbox                           0x00007fff8e6ee26a SendMenuItemSelectedEvent + 188
23  HIToolbox                           0x00007fff8e6ee13d _ZL19FinishMenuSelectionP13SelectionDataP10MenuResultS2_ + 96
24  HIToolbox                           0x00007fff8e6eeb77 _ZL14MenuSelectCoreP8MenuData5PointdjPP13OpaqueMenuRefPt + 702
25  HIToolbox                           0x00007fff8e6ee826 _HandleMenuSelection2 + 460
26  AppKit                              0x00007fff8cf00079 _NSHandleCarbonMenuEvent + 239
27  AppKit                              0x00007fff8d17a322 _DPSEventHandledByCarbon + 54
28  AppKit                              0x00007fff8d4904eb -[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 613
29  AppKit                              0x00007fff8cd74fbd -[NSApplication run] + 926
30  AppKit                              0x00007fff8cd3fa8a NSApplicationMain + 1237
31  _AppKit.so                          0x0000000106a465f9 init_AppKit + 8566
32  Python                              0x00000001068acd8c PyEval_EvalFrameEx + 14342
33  Python                              0x00000001068a9352 PyEval_EvalCodeEx + 1409
34  Python                              0x00000001068afbf1 _PyEval_SliceIndex + 757
35  Python                              0x00000001068ac9a6 PyEval_EvalFrameEx + 13344
36  Python                              0x00000001068a9352 PyEval_EvalCodeEx + 1409
37  Python                              0x00000001068ad768 PyEval_EvalFrameEx + 16866
38  Python                              0x00000001068a9352 PyEval_EvalCodeEx + 1409
39  Python                              0x00000001068afbf1 _PyEval_SliceIndex + 757
40  Python                              0x00000001068ac9a6 PyEval_EvalFrameEx + 13344
41  Python                              0x00000001068a9352 PyEval_EvalCodeEx + 1409
42  Python                              0x00000001068a8dcb PyEval_EvalCode + 54
43  Python                              0x00000001068c900e PyParser_ASTFromFile + 315
44  Python                              0x00000001068c90b1 PyRun_FileExFlags + 133
45  Python                              0x00000001068c8c4e PyRun_SimpleFileExFlags + 769
46  DrawBot                             0x0000000104ed9a40 main + 7190
47  DrawBot                             0x0000000104ed83f8 main + 1486
48  libdyld.dylib                       0x00007fffa4128255 start + 1
49  ???                                 0x0000000000000001 0x0 + 1

a api callback to get the number of pages in a pdf

proposals:

  • numberOfPages(pathToPDF)
  • pdfNumberOfPages(pathToPDF)
  • imagePages(pathToPDF) ?? no

this is useful as image(pathToPDF, (x, y), pageNumber=2) is possible to draw a specific page from a multipage pdf.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.