慕碼人8056858
2021-11-03 16:04:21
https://p5js.org/reference/#/p5.Font/textToPoints此函數(shù)跟蹤文本的邊界并為我提供該邊界中的點數(shù)組。我們在 Processing 或 Java API 中是否有類似的東西?
1 回答

慕的地10843
TA貢獻1785條經(jīng)驗 獲得超8個贊
它可以在 Processing 中基于每個字符完成。
獲取給定字符的邊緣頂點
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);
結(jié)果(字符 = 'H',字體 = Comfortaa)
添加回答
舉報
0/150
提交
取消