aboutsummaryrefslogtreecommitdiff
path: root/files/ru/web/api/canvasrenderingcontext2d/textbaseline
diff options
context:
space:
mode:
authorPeter Bengtsson <mail@peterbe.com>2020-12-08 14:42:52 -0500
committerPeter Bengtsson <mail@peterbe.com>2020-12-08 14:42:52 -0500
commit074785cea106179cb3305637055ab0a009ca74f2 (patch)
treee6ae371cccd642aa2b67f39752a2cdf1fd4eb040 /files/ru/web/api/canvasrenderingcontext2d/textbaseline
parentda78a9e329e272dedb2400b79a3bdeebff387d47 (diff)
downloadtranslated-content-074785cea106179cb3305637055ab0a009ca74f2.tar.gz
translated-content-074785cea106179cb3305637055ab0a009ca74f2.tar.bz2
translated-content-074785cea106179cb3305637055ab0a009ca74f2.zip
initial commit
Diffstat (limited to 'files/ru/web/api/canvasrenderingcontext2d/textbaseline')
-rw-r--r--files/ru/web/api/canvasrenderingcontext2d/textbaseline/index.html100
1 files changed, 100 insertions, 0 deletions
diff --git a/files/ru/web/api/canvasrenderingcontext2d/textbaseline/index.html b/files/ru/web/api/canvasrenderingcontext2d/textbaseline/index.html
new file mode 100644
index 0000000000..545cf211b5
--- /dev/null
+++ b/files/ru/web/api/canvasrenderingcontext2d/textbaseline/index.html
@@ -0,0 +1,100 @@
+---
+title: CanvasRenderingContext2D.textBaseline
+slug: Web/API/CanvasRenderingContext2D/textBaseline
+tags:
+ - API
+ - Canvas
+ - Property
+translation_of: Web/API/CanvasRenderingContext2D/textBaseline
+---
+<div>{{APIRef}}</div>
+
+<p><code><strong>CanvasRenderingContext2D</strong></code><strong><code>.textBaseline</code></strong> - свойство Canvas 2D API, указывающее на текущую базовую линию при рисовании текста.</p>
+
+<h2 id="Синтаксис">Синтаксис</h2>
+
+<pre class="syntaxbox"><em>ctx</em>.textBaseline = "top" || "hanging" || "middle" || "alphabetic" || "ideographic" || "bottom";
+</pre>
+
+<h3 id="Опции">Опции</h3>
+
+<p>Возможные значения:</p>
+
+<dl>
+ <dt><code>"top"</code></dt>
+ <dd>The text baseline is the top of the em square.</dd>
+ <dt><code>"hanging"</code></dt>
+ <dd>The text baseline is the hanging baseline. (Used by Tibetan and other Indic scripts.)</dd>
+ <dt><code>"middle"</code></dt>
+ <dd>The text baseline is the middle of the em square.</dd>
+ <dt><code>"alphabetic"</code></dt>
+ <dd>The text baseline is the normal alphabetic baseline. Значение по умолчанию.</dd>
+ <dt><code>"ideographic"</code></dt>
+ <dd>The text baseline is the ideographic baseline; this is the bottom of the body of the characters, if the main body of characters protrudes beneath the alphabetic baseline. (Used by Chinese, Japanese, and Korean scripts.)</dd>
+ <dt><code>"bottom"</code></dt>
+ <dd>The text baseline is the bottom of the bounding box. This differs from the ideographic baseline in that the ideographic baseline doesn't consider descenders.</dd>
+</dl>
+
+<h2 id="Примеры">Примеры</h2>
+
+<h3 id="Сравнение_значений_свойства">Сравнение значений свойства</h3>
+
+<p>Этот пример демонстрирует различные значения свойства <code>textBaseline</code> и отображение линий при их приминениях.</p>
+
+<h4 id="HTML">HTML</h4>
+
+<pre class="brush: html">&lt;canvas id="canvas" width="550" height="500"&gt;&lt;/canvas&gt;
+</pre>
+
+<h4 id="JavaScript">JavaScript</h4>
+
+<pre class="brush: js">const canvas = document.getElementById('canvas');
+const ctx = canvas.getContext('2d');
+
+const baselines = ['top', 'hanging', 'middle', 'alphabetic', 'ideographic', 'bottom'];
+ctx.font = '36px serif';
+ctx.strokeStyle = 'red';
+
+baselines.forEach(function (baseline, index) {
+ ctx.textBaseline = baseline;
+ let y = 75 + index * 75;
+ ctx.beginPath();
+ ctx.moveTo(0, y + 0.5);
+ ctx.lineTo(550, y + 0.5);
+ ctx.stroke();
+ ctx.fillText('Abcdefghijklmnop (' + baseline + ')', 0, y);
+});
+</pre>
+
+<h4 id="Результат">Результат</h4>
+
+<p>{{ EmbedLiveSample('Comparison_of_property_values', 700, 550) }}</p>
+
+<h2 id="Спецификации">Спецификации</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">Спецификация</th>
+ <th scope="col">Статус</th>
+ <th scope="col">Комментарий</th>
+ </tr>
+ <tr>
+ <td>{{SpecName('HTML WHATWG', "scripting.html#dom-context-2d-textbaseline", "CanvasRenderingContext2D.textBaseline")}}</td>
+ <td>{{Spec2('HTML WHATWG')}}</td>
+ <td> </td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="Поддержка_браузерами">Поддержка браузерами</h2>
+
+
+
+<p>{{Compat("api.CanvasRenderingContext2D.textBaseline")}}</p>
+
+<h2 id="Смотрите_также">Смотрите также</h2>
+
+<ul>
+ <li>Интерфейс определяющий это свойство: {{domxref("CanvasRenderingContext2D")}}</li>
+</ul>