Qiita Teams that are logged in
You are not logged in to any team

Log in to Qiita Team
Community
OrganizationAdvent CalendarQiitadon (β)
Service
Qiita JobsQiita ZineQiita Blog
15
Help us understand the problem. What is going on with this article?
@enkatsu

Processingでフォントのアウトラインを取得する

More than 3 years have passed since last update.

Processing3.0.1を使用

FontShpe.pde
PFont font;
PShape pShape;

void setup() {
  size(300, 200);
  //まずはPFontを生成
  font = createFont("osaka", 100);
  //次にフォントからPShapeを取得
  pShape = font.getShape('P', 1);
  //取得したままのスタイルだと表示されないので設定
  pShape.beginShape();
  pShape.strokeWeight(1);
  pShape.stroke(0);
  pShape.fill(255);
  pShape.endShape();

  background(100);

  //まずはPShapeを使って描画
  translate(100, 100);
  shape(pShape, 0, 0);

  //次にvertexを取り出して描画
  translate(100, 0);
  beginShape();
  for (int i = 0; i < pShape.getVertexCount(); i++) {
    vertex(pShape.getVertex(i).x, pShape.getVertex(i).y);
  }
  endShape();
}

void draw() {
}

こんな感じになると思う
FontShape.png

バネの動きを入れるとこんな感じ

FontShape.gif

他にも色々使えそう

15
Help us understand the problem. What is going on with this article?
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
enkatsu
Processing, oF, Cinder, Python, Ruby, JS

Comments

No comments
Sign up for free and join this conversation.
Sign Up
If you already have a Qiita account Login
15
Help us understand the problem. What is going on with this article?