Navigation

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Users
    • Groups
    • Solved
    • Unsolved
    • Search
    1. Home
    2. frederik
    3. Posts
    • Profile
    • Following
    • Followers
    • Topics
    • Posts
    • Best
    • Groups

    Posts made by frederik

    • RE: when to apply paragraphBottomSpacing

      I guess this is a coreText thing. When composing the same text with hard returns and soft returns (shift + enter) in TextEdit, there is no difference between soft and hard returns.

      97bc7514-5ad3-49a9-a954-a2362b5dd714-image.png

      I guess you'll need to script it and change the the bottom spacing for text-runs with soft returns.

      posted in Feature Requests
      frederik
      frederik
    • RE: listNamedInstances is broken ?

      thanks for the issue

      --> https://github.com/typemytype/drawbot/issues/495

      posted in General Discussion
      frederik
      frederik
    • RE: listNamedInstances is broken ?

      can you provide the not working google fonts?

      and if this is persisting, it would be handy to open an issue in the drawBot repo.

      thanks!

      posted in General Discussion
      frederik
      frederik
    • RE: Running Drawbot as a module in environments that aren't Mac OS X

      DrawBot is mac only... that will not change fast as we got now a super high level of typographic support...

      However Just started drawBotSkia which has a subset of the DrawBot api but uses skia as backend.

      see https://github.com/justvanrossum/drawbot-skia

      posted in Bugs
      frederik
      frederik
    • RE: Mute DrawBot warning ?

      you can always ignore all warnings with:

      import warnings
      warnings.simplefilter("ignore")
      

      see https://docs.python.org/3.7/library/warnings.html

      posted in General Discussion
      frederik
      frederik
    • RE: Mute DrawBot warning ?

      which warning?

      posted in General Discussion
      frederik
      frederik
    • RE: BezierPath offset problem.

      the mistake here is that bounds are not structured as x, y, width, height as required for rect(...)but as minx, miny, maxx, maxy.

      minx, miny, maxx, maxy = path.bounds()
      rect(minx, miny, maxx-minx, maxy-miny)
      
      posted in General Discussion
      frederik
      frederik
    • RE: Python Update ?

      no, you can not.. but DrawBot exists also as a module where you can use your own python.

      see https://github.com/typemytype/drawbot#using-drawbot-as-a-python-module

      posted in General Discussion
      frederik
      frederik
    • RE: Beginner Question

      its all the same and very much based on coding flavours

      different approach, similar result, here you know the amount of lines exactly.

      import random
      
      size(600, 849)
      
      margin = 106
      density = [3,2,7,20, 1002] # the amount of lines
      rows = len(density)
      row_width = width() - 2 * margin
      row_height = (height() - 2 * margin) / rows
      
      fill(None)
      strokeWidth(1)
      stroke(0)
      
      for i, d in enumerate(density):
          y1 = margin + i * row_height
          y2 = y1 + row_height
          x_positions = [random.random() * row_width for _ in range(d)]
          for x in x_positions:
              line((x, y1),(x, y2))
      
      posted in General Discussion
      frederik
      frederik
    • RE: Beginner Question

      thanks @monomonnik! very well explained!

      the while loop at the end makes its maybe a bit unreadable...

      you can use random.sample to generate a random list easily:

      import random
      
      density = 5
      result = random.sample(range(0, 100), density)
      print(result)
      
      posted in General Discussion
      frederik
      frederik
    • RE: Rewind rect() x position for endless movement

      I guess you made it to difficult...

      
      Variable([
          dict(name="progress", ui="Slider",
                  args=dict(
                      value=0,
                      minValue=0,
                      maxValue=1,
                      )),
          ], globals())
          
      backgroundColors = [
          (0.5, 1, 0.5), 
          (0.5, 1, 1), 
          (0.5, 0, 0), 
          (1, 1, 0), 
          (0.5, 0, 1), 
          (0.5, 0.5, 0.5), 
          (0, 1, 0)
      ]
      
      # pageW, pageH = (500, 500)
      pageW, pageH = width(), height()
      
      
      advance = pageW * progress
      
      itemCount = len(backgroundColors)
      itemWidth = pageW / (itemCount)
      
      moveIndex = int(advance * progress // itemWidth)
      backgroundColors = backgroundColors[-moveIndex:] + backgroundColors
      
      for i in range(0, itemCount + 1):
          color = backgroundColors[i]
          fill(*color)    
          rect(itemWidth * (i-moveIndex) - itemWidth + advance * progress, 0, itemWidth, pageH)
      
      fill(None)
      stroke(0)
      strokeWidth(10)
      rect(0, 0, pageW, pageH)
      
      
      posted in General Discussion
      frederik
      frederik
    • RE: Messed-up font metrics in Drawbot

      lets continue here: https://github.com/typemytype/drawbot/issues/481

      posted in Bugs
      frederik
      frederik
    • RE: The promise and perils of expandStroke()

      yes, this is the postScript interpretation of expanding a path... this is visually the 'best' solution but from a curve standpoint horrible 🙂

      Take a look at my Outliner for outlining strokes, there is a pen and multiple options!

      posted in General Discussion
      frederik
      frederik
    • RE: Clip off text in textBox

      you can calculate the textSize in side a while loop and stop if the text is smaller then the page width:

      newPage(1500,1500)
      
      lh = 10
      
      factor = 1
      for i in range(17):
          fs = 1 * (i + 1) * factor
          fontSize(fs)
          lineHeight(fs * 0.8)
          # store the text to draw in a variable
          t = f"AaBbCc {round(fs)} pt"
          # start the while, while there is some text in t
          while t:
              # get the text size of that string
              w, h = textSize(t)
              # check if the width is smaller then the page width
              if w < width():
                  # break the while loop 
                  break
              # the string is still wider then the page width: remove the last character
              t = t[:-1]
          textBox(t, (10, lh, width(), fs))
          lh += fontLineHeight() + 7
          factor += 1
      

      good luck!

      posted in General Discussion
      frederik
      frederik
    • RE: Clip off text in textBox

      Just make the textBox wider? 😉

      posted in General Discussion
      frederik
      frederik
    • RE: Help combining ideas

      Thanks @jo!

      posted in General Discussion
      frederik
      frederik
    • RE: PIL or Pillow installation issues and PNG metadata

      what version of drawBot do you use?

      PIL (pillow) is embedded now as a package inside the app bundle.

      posted in General Discussion
      frederik
      frederik
    • RE: How to stop (Kill) an accidental infinite loop without force quitting?

      cmd + . works in a pre 10.14 OSs...

      DrawBot saves your code in a the prefs: with this key: DrawBotCodeBackup. On every startup DrawBot checks this key, if there is something it will open a new window with the stored code.

      This could be more visible like saving to disk when it goes bogus...

      there is already an issue open for this: https://github.com/typemytype/drawbot/issues/464

      posted in General Discussion
      frederik
      frederik
    • RE: Empty font properties. Cache?

      which version of DrawBot are you using?

      is this happening inside the app or when you use DrawBot as a module?

      posted in Bugs
      frederik
      frederik
    • RE: Empty font properties. Cache?

      mm, strange... listNamedInstances must return a dict and listOpenTypeFeatures a list even if the font has no instances or features

      could you provide a dummy font? (offlist: frederik@typemytype.com)

      posted in Bugs
      frederik
      frederik