TextMetrics: ideographicBaseline プロパティ
Baseline
2023
Newly available
Since October 2023, this feature works across the latest devices and browser versions. This feature might not work in older devices or browsers.
メモ: この機能はウェブワーカー内で利用可能です。
ideographicBaseline は TextMetrics インターフェイスの読み取り専用プロパティで、double 型であり、CanvasRenderingContext2D.textBaseline プロパティで示される水平線から、行ボックスの表意文字ベースライン(訳注:漢字のベースライン)までの距離を CSS ピクセル単位で返します。
例
js
const canvas = document.createElement("canvas");
const ctx = canvas.getContext("2d");
const text = ctx.measureText("foo"); // TextMetrics オブジェクトを返す
text.ideographicBaseline; // -1.201171875;
仕様書
| Specification |
|---|
| HTML> # dom-textmetrics-ideographicbaseline-dev> |