SVGTextContentElement: getRotationOfChar()-Methode

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since January 2020.

Die getRotationOfChar()-Methode der Schnittstelle SVGTextContentElement repräsentiert die Rotation eines typografischen Zeichens.

Syntax

js
getRotationOfChar(index)

Parameter

index

Ein integer; der Index des Zeichens.

Rückgabewert

Ein Float; der Rotationswinkel des Zeichens in Grad.

Ausnahmen

IndexSizeError DOMException

Wird ausgelöst, wenn kein Zeichen an index gefunden wird.

Beispiele

Abfragen der Rotation eines Zeichens

html
<svg width="200" height="100">
  <text id="exampleText" x="10" y="40" writing-mode="vertical-rl">
    Hello, SVG
  </text>
</svg>
js
const textElement = document.getElementById("exampleText");

// Get the rotation of the first character "H"
const rotation = textElement.getRotationOfChar(0);

console.log(extent); // Output: 90

Spezifikationen

Specification
Scalable Vector Graphics (SVG) 2
# __svg__SVGTextContentElement__getRotationOfChar

Browser-Kompatibilität

Report problems with this compatibility data on GitHub
desktopmobile
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
getRotationOfChar

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support

Siehe auch