Navigation

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

    Topics created by MauriceMeilleur

    • MauriceMeilleur

      Defining lineHeight and first baseline: status?
      Bugs • • MauriceMeilleur  

      8
      0
      Votes
      8
      Posts
      64
      Views

      MauriceMeilleur

      In case anyone's following this thread: over on RoboFont's Discord, thanks to Wim asking we determined that the issue had mainly to do with a bug in a pre-release version of DB I was using; using v3.130 cleared things up.
    • MauriceMeilleur

      Can I use use areaAverage() to analyze an actual image?
      General Discussion • • MauriceMeilleur  

      5
      0
      Votes
      5
      Posts
      26
      Views

      monomonnik

      The thing that tripped me up initially was ‘Returns a single-pixel image…’. I was (mis)reading that and assumed that ‘returns’ meant ‘returns a new image’ instead of altering the imageObject. I’m not sure if the documentation is a little confusing, or that the behaviour of areaAverage is unexpected.
    • MauriceMeilleur

      saveImage() .mp4 options: Looping?
      Feature Requests • • MauriceMeilleur  

      1
      0
      Votes
      1
      Posts
      7
      Views

      No one has replied

    • MauriceMeilleur

      The promise and perils of expandStroke()
      General Discussion • • MauriceMeilleur  

      3
      0
      Votes
      3
      Posts
      17
      Views

      frederik

      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!
    • MauriceMeilleur

      Am I missing something from expandStroke() documentation?
      General Discussion • • MauriceMeilleur  

      3
      0
      Votes
      3
      Posts
      15
      Views

      MauriceMeilleur

      @monomonnik Oh, I see—I was treating it like a method. Thanks.
    • MauriceMeilleur

      FontTools, probably a simple question
      General Discussion • • MauriceMeilleur  

      3
      0
      Votes
      3
      Posts
      13
      Views

      MauriceMeilleur

      @frederik Oh, I see—I just needed to import (from) the right submodule. Thanks!
    • MauriceMeilleur

      .svg resolution/units options for saveImage()
      Feature Requests • • MauriceMeilleur  

      2
      0
      Votes
      2
      Posts
      10
      Views

      frederik

      continue here https://github.com/typemytype/drawbot/issues/428
    • MauriceMeilleur

      SOLVED Gaussian blur moves object when applied in different places in the code?
      Bugs • • MauriceMeilleur  

      2
      0
      Votes
      2
      Posts
      19
      Views

      frederik

      not really a bug: when applying a blur the images gets bigger, check with im.size() before and after the blur is applied. im.offset() is providing you the correct x, y difference.
    • MauriceMeilleur

      SOLVED Why would I declare a newPath() as opposed to defining a BezierPath() with a variable name?
      General Discussion • • MauriceMeilleur  

      3
      0
      Votes
      3
      Posts
      18
      Views

      MauriceMeilleur

      That's what I suspected. It seemed like the kind of question students would ask and I wanted to make sure the answer I gave was the right one. Thanks, Frederik.
    • MauriceMeilleur

      UNSOLVED Cryptic error language in the pip/PyPi frontend
      General Discussion • library nodebox pip pypi • • MauriceMeilleur  

      6
      0
      Votes
      6
      Posts
      35
      Views

      frederik

      this should be resolved in the latest update!!!
    • MauriceMeilleur

      SOLVED Changing a list derived from a reference list also changes the reference list?
      General Discussion • • MauriceMeilleur  

      4
      0
      Votes
      4
      Posts
      34
      Views

      frederik

      g is just a reference to the same object. You need to create a copy to get a new object with the same content. import copy a = 1 b = [(a, a), (a + 1, a + 1)] print(id(b)) g = b print(id(g)) g = copy.deepcopy(b) print(id(g))
    • MauriceMeilleur

      UNSOLVED Alpha channel in linear and radial gradients
      Feature Requests • gradient transparency • • MauriceMeilleur  

      4
      0
      Votes
      4
      Posts
      53
      Views

      MauriceMeilleur

      @frederik Thanks (and thanks for opening this over in the GitHub repo). I'll give it a try later today. Speed isn't a factor in this case because I'm generating static diagrams.
    • MauriceMeilleur

      SOLVED Editing BezierPaths directly
      General Discussion • bezierpath • • MauriceMeilleur  

      4
      0
      Votes
      4
      Posts
      92
      Views

      frederik

      The documentation is adjusted and path.onCurvePoints and path.offCurvePoints and the path contours are immutable now. see https://github.com/typemytype/drawbot/pull/350
    • MauriceMeilleur

      SOLVED Size of text box doesn't correspond exactly to fontSize
      Bugs • text fontsize size • • MauriceMeilleur  

      4
      0
      Votes
      4
      Posts
      61
      Views

      gferreira

      But that means that default linespacing = fontSize + 1? not really… it depends on the vertical metrics in the font. here’s a test with other fonts: from random import choice fontName = choice(installedFonts()) txt = FormattedString() txt.append('a', fontSize=1000, font=fontName) print(fontName) print(textSize(txt)[1]) line height is tricky see 1 2 3 4
    • MauriceMeilleur

      SOLVED Problems with cv2? Alternative for resizing saved images on the fly?
      General Discussion • • MauriceMeilleur  

      3
      0
      Votes
      3
      Posts
      39
      Views

      MauriceMeilleur

      That's a nice workaround, thanks! I didn't consider the resolution parameter since I was thinking in terms of the absolute size of the image in pixels only. Maybe I'll put in a feature request, since pixel dimensions feels like a more intuitive way to characterize output.
    • MauriceMeilleur

      SOLVED Text to outlines > find objects with similar fill > Boolean operations?
      General Discussion • • MauriceMeilleur  

      5
      0
      Votes
      5
      Posts
      94
      Views

      MauriceMeilleur

      @frederik But I figured it out! Obviously the fill/stroke properties from the formatted strings won't find their way into the Bezier paths, but I can just add them to the paths directly. (I guess I could just use text, but I want some flexibility in the code for when Kast is a variable font.) Just have to write the code to clean/chop up strings into even lines and size the text to position/size the lines to make fields. A really useful Maurice-bot would tell me to do the work first and then post just to share the results and the code.
    • MauriceMeilleur

      SOLVED A little arcTo() and geometry help?
      General Discussion • bezierpath recreations trigonometry • • MauriceMeilleur  

      7
      0
      Votes
      7
      Posts
      193
      Views

      MauriceMeilleur

      The finished product, a tribute to Bridget Riley's Rustle 6 (2015). import math canvasX = 600 canvasY = 600 nFrames = 120 side = canvasX/14 height = (side * sqrt(3))/2 center = (side/sqrt(3))/2 nX = 14 nY = 15 offsetX = side offsetY = height from datetime import * time = datetime.now() def interpolate(pt1, pt2, ratio): assert ratio <= 1 return (pt1[0] + (ratio * (pt2[0] - pt1[0])), pt1[1] + (ratio * (pt2[1] - pt1[1]))) def triangle(s, h, c, inout): assert inout >= 0 and inout <= 1 start = (-s/2, h/2) pivot = (0, h/2 - (c * 3)) target = (s/2, h/2) control = interpolate((s/2, -c/2), (0, h/2 - c), inout) radius = s # optimal distance to control points is (4/3)*tan(pi/(2n); thank you https://stackoverflow.com/users/16673/suma for answering this question https://stackoverflow.com/questions/1734745/how-to-create-circle-with-b%C3%A9zier-curves control_ratio = ((4/3 * tan(pi/12)) * radius) / (2 * c) controlP = interpolate(pivot, control, control_ratio) controlT = interpolate(target, control, control_ratio) triangle = BezierPath() triangle.moveTo(start) triangle.lineTo(pivot) triangle.curveTo(controlP, controlT, target) triangle.closePath() drawPath(triangle) def frame(x, y, m): f = BezierPath() g = BezierPath() f.rect(0, 0, x, y) g.rect(m, m, x - (2 * m), y - (2 * m)) f = f.difference(g) f.closePath() drawPath(f) # original Riley plan for Rustle 6 plan = [ [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 1, 0, 0, 0, -1, 0, 0, 0, 1, 0, 0], [-1, 0, -1, 0, 0, 0, 0, 0, 1, 0, -1, 0, 0], [1, 0, 1, -1, 0, 0, -1, 0, 0, 0, 1, 0, 1, 0], [0, -1, 0, -1, 0, 0, 0, 1, 0, -1, 0, -1, 0], [0, 1, -1, 1, 0, 1, 0, 0, 0, 0, -1, 1, 0, 0], [-1, 0, -1, 0, 0, 0, 0, 0, 0, 0, -1, 0, -1], [1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0], [0, -1, 0, 0, 0, 0, 0, 0, 0, -1, 0, -1, 0], [0, -1, 0, 1, 0, 1, 0, 1, 0, 0, 0, 1, -1, 0], [-1, 0, -1, 0, 0, 0, 0, 0, 0, 0, -1, -1, -1], [-1, 0, -1, 0, 1, 0, 1, 0, 0, 0, 1, -1, -1, 0], [0, -1, 0, 0, 0, 0, 0, 0, 0, -1, 0, -1, -1, 0], [0, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], ] for n in range(nFrames): newPage(canvasX, canvasY) frameDuration(1/30) ex = sin(radians(n * (360/nFrames))) fill(1) rect(0, 0, canvasX, canvasY) with savedState(): translate(canvasX/2, canvasY/2) fill(0) translate(-(nX - 1) * offsetX/2, (nY - 1) * offsetY/2) for i in range(nY): with savedState(): translate(0, i * -offsetY) if i % 2 == 0: for j in range(nX - 1): with savedState(): translate(offsetX/2 + (j * offsetX), 0) triangle(side, height, center, .5 - (ex * (plan[i][j] * .5))) else: for j in range(nX): with savedState(): translate(j * offsetX, 0) triangle(side, height, center, .5 - (ex * (plan[i][j] * .5))) fill(1) frame(canvasX, canvasY, side/2) saveImage('~/Desktop/riley_tribute_test_01_%s.gif' %time) The reference image:
    • MauriceMeilleur

      UNSOLVED Using arcTo() for variable-radius corner-rounding
      General Discussion • trigonometry • • MauriceMeilleur  

      1
      0
      Votes
      1
      Posts
      193
      Views

      No one has replied