CreativeInquiry / PEmbroider

Embroidery Library for Processing
Other
443 stars 28 forks source link

Text partially cut off #112

Open jvolker opened 6 months ago

jvolker commented 6 months ago

I've noticed a glitch in the font rendering. The top part of the dot of the i is being cut off.

image

I've used the demo font available at https://www.fontspring.com/fonts/rene-bieder/freigeist and the following code:

// Test program for the PEmbroider library for Processing:
// Optimize each character in text individually. 

import processing.embroider.*;
PEmbroiderGraphics E;

void setup() {
  // noLoop(); 
  size (700, 400);
  PFont myFont = createFont("FONTSPRINGDEMO-FreigeistBlackItalic", 360);

  textAlign(CENTER, BASELINE);
  textFont(myFont);
  textSize(160);
  text("Wisdom", width/2, height/2);

  E = new PEmbroiderGraphics(this, width, height);
  E.TEXT_OPTIMIZE_PER_CHAR = false; 
  E.hatchSpacing(5);

  E.beginDraw(); 
  E.clear();
  E.textAlign(CENTER, BASELINE);
  E.textFont(myFont);
  E.textSize(160);
  E.fill(0);
  E.stroke(0); 

  E.text("Wisdom", width/2, height/2);
  //E.optimize();
  E.visualize(true, false, false);

  boolean bDoExportEmbroideryFile = false;
  if (bDoExportEmbroideryFile) {
    String outputFilePath = sketchPath("PEmbroider_text_1.vp3");
    E.setPath(outputFilePath); 
    E.endDraw();
  }
}

void draw() {
  // background(200);
  // E.visualize(true,false,false,frameCount);
}

void keyPressed() {
  if (key == ' ') {
    save("PEmbroider_optimize_per_char.png");
  }
}

Using Processing 4.3 and latest PEmbroider.

Thanks for looking into it.