svg-engine
Version:
Create SVG files in Node.js
40 lines • 1.36 kB
JavaScript
import { SVGInstance } from "../../../browser/instance/SVGInstance.js";
export class Font extends SVGInstance {
fontFamily(fontFamily) {
if (typeof fontFamily === "undefined") {
const fontFamily = this.attr("font-family");
return typeof fontFamily === "string" ? fontFamily : null;
}
else if (typeof fontFamily === "string") {
this.attr("font-family", fontFamily);
return this;
}
return null;
}
fontSize(fontSize) {
if (typeof fontSize === "string" || typeof fontSize === "number") {
this.attr("font-size", fontSize);
return this;
}
return this.attr("font-size");
}
fontStyle(fontStyle) {
if (typeof fontStyle === "undefined") {
const fontStyle = this.attr("font-style");
return typeof fontStyle === "string" ? fontStyle : null;
}
else if (typeof fontStyle === "string") {
this.attr("font-style", fontStyle);
return this;
}
return null;
}
fontWeight(fontWeight) {
if (typeof fontWeight === "string" || typeof fontWeight === "number") {
this.attr("font-weight", fontWeight);
return this;
}
return this.attr("font-weight");
}
}
//# sourceMappingURL=font.js.map