--- title: text-rendering slug: Web/SVG/Attribute/text-rendering translation_of: Web/SVG/Attribute/text-rendering ---
« SVG Attribute reference home
При создание SVG есть возможность указать браузеру о том, как рекомендуется рендерить (отрисовывать) текст. text-rendering предоставляет возможность указывать данные рекомендации.
Помимо presentation attribute, настройки ренедеринга шрифтов можно задать через CSS стили. Для получения дополнительной информации смотри {{ cssxref("text-rendering","CSS text-rendering") }}.
| Категория | Presentation attribute |
|---|---|
| Значение | auto | optimizeSpeed | optimizeLegibility | geometricPrecision | inherit |
| Animatable | Yes |
| Normative document | SVG 1.1 (2nd Edition) |
<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg"
version="1.1" width="660" height="40"
text-rendering="optimizeLegibility">
<link xmlns="http://www.w3.org/1999/xhtml" href='http://fonts.googleapis.com/css?family=Sofadi+One' rel='stylesheet' type='text/css' />
<style>
text {font: 30px 'Sofadi One', cursive;}
</style>
<g>
<text y="30">The quick brown fox jumps over the lazy dog.</text>
</g>
</svg>
optimizeLegibility (первая) и geometricPrecision (вторая)
Аналогичным образом действует {{ cssxref("text-rendering","CSS text-rendering") }}
<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg"
version="1.1" width="660" height="40">
<link xmlns="http://www.w3.org/1999/xhtml" href='http://fonts.googleapis.com/css?family=Sofadi+One' rel='stylesheet' type='text/css' />
<style>
text {
font: 30px 'Sofadi One', cursive;
text-rendering:optimizeLegibility;
}
</style>
<g>
<text y="30">The quick brown fox jumps over the lazy dog.</text>
</g>
</svg>
The following elements can use the text-rendering attribute