处理字体的 p5.js textToPoints() 函数的等效项是什么?
what is processing equivalent of p5.js textToPoints() functions for fonts?
https://p5js.org/reference/#/p5.Font/textToPoints
此函数跟踪文本的边界并为我提供该边界中的点数组。
我们在 Processing 或 Java API 中是否有与此等效的内容?
可以在处理中以每个字符为基础完成。
获取给定字符的边顶点
ArrayList<PVector> edgeVertices = new ArrayList<>();
PFont font = createFont("Arial", 96, true);
PShape shape = font.getShape(char c);
for (int i = 0; i < shape.getVertexCount(); i++) {
edgeVertices.add(shape.getVertex(i));
}
从边缘顶点绘制轮廓
strokeWeight(2);
beginShape();
for (PVector v : edgeVertices) {
vertex(v.x + 55, v.y + 125);
}
endShape(CLOSE);
结果(字符='H',字体=Comfortaa)
https://p5js.org/reference/#/p5.Font/textToPoints
此函数跟踪文本的边界并为我提供该边界中的点数组。
我们在 Processing 或 Java API 中是否有与此等效的内容?
可以在处理中以每个字符为基础完成。
获取给定字符的边顶点
ArrayList<PVector> edgeVertices = new ArrayList<>();
PFont font = createFont("Arial", 96, true);
PShape shape = font.getShape(char c);
for (int i = 0; i < shape.getVertexCount(); i++) {
edgeVertices.add(shape.getVertex(i));
}
从边缘顶点绘制轮廓
strokeWeight(2);
beginShape();
for (PVector v : edgeVertices) {
vertex(v.x + 55, v.y + 125);
}
endShape(CLOSE);
结果(字符='H',字体=Comfortaa)