0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

P5.js 日本語リファレンス(textLeading)

Last updated at Posted at 2020-06-19

このページでは[「P5.js 日本語リファレンス」] (https://qiita.com/bit0101/items/91818244dc26c767a0fe) の textLeading関数を説明します。

textLeading()

説明文

テキストの行間の間隔をピクセル単位で設定/取得します。この設定は textSize() の以降のすべての呼び出しで使用できます。

構文

textLeading(leading)

textLeading()

パラメタ

  • leading
    Number:設定する行間隔のサイズ(ピクセル単位)

例1

function setup(){
  createCanvas(200, 200);
  textSize(12);

  // 表示するテキスト。 '\n' は「改行」文字です
  let lines1 = 'ABC\nDEF\nGHI\nJKL\nMNO\nPQR\nSTU';
  // 行間隔を10に設定します
  textLeading(10);
  text(lines1, 10, 25);

  // 表示するテキスト。 '\n' は「改行」文字です
  let lines2 = 'ABC\nDEF\nGHI\nJKL';
  // 行間隔を20に設定します
  textLeading(20);
  text(lines2, 50, 25);

  // 表示するテキスト。 '\n' は「改行」文字です
  let lines3 = 'ABC\nDEF\nGHI';
  // 行間隔を30に設定します
  textLeading(30);
  text(lines3, 90, 25);
}

実行結果

著作権

p5.js was created by Lauren McCarthy and is developed by a community of collaborators, with support from the Processing Foundation and NYU ITP. Identity and graphic design by Jerel Johnson.

ライセンス

Creative Commons(CC BY-NC-SA 4.0) に従います。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?