संग्रह की मदद से व्यवस्थित रहें
अपनी प्राथमिकताओं के आधार पर, कॉन्टेंट को सेव करें और कैटगरी में बांटें.
ब्लॉकली > utils > डॉम > getFastTextWidth
utils.dom.getFastTextwidth() फ़ंक्शन
getTextWidth
से ज़्यादा तेज़ तरीके का इस्तेमाल करके, टेक्स्ट एलिमेंट की चौड़ाई हासिल करता है. इस तरीके के लिए यह ज़रूरी है कि हमें टेक्स्ट एलिमेंट की फ़ॉन्ट फ़ैमिली और साइज़ की जानकारी पहले से हो. getTextWidth
की तरह, हम जिस चौड़ाई का हिसाब लगाते हैं उसे कैश मेमोरी में सेव किया जाता है.
हस्ताक्षर:
export declare function getFastTextWidth(textElement: SVGTextElement, fontSize: number, fontWeight: string, fontFamily: string): number;
पैरामीटर
पैरामीटर |
टाइप |
ब्यौरा |
textElement |
SVGTextElement |
SVG 'text' एलिमेंट. |
fontSize |
संख्या |
इस्तेमाल करने के लिए फ़ॉन्ट का साइज़. |
fontWeight |
स्ट्रिंग |
इस्तेमाल करने के लिए फ़ॉन्ट की मोटाई. |
fontFamily |
स्ट्रिंग |
इस्तेमाल करने के लिए फ़ॉन्ट फ़ैमिली. |
लौटाए जाने वाले प्रॉडक्ट:
संख्या
एलिमेंट की चौड़ाई.
जब तक कुछ अलग से न बताया जाए, तब तक इस पेज की सामग्री को Creative Commons Attribution 4.0 License के तहत और कोड के नमूनों को Apache 2.0 License के तहत लाइसेंस मिला है. ज़्यादा जानकारी के लिए, Google Developers साइट नीतियां देखें. Oracle और/या इससे जुड़ी हुई कंपनियों का, Java एक रजिस्टर किया हुआ ट्रेडमार्क है.
आखिरी बार 2025-07-25 (UTC) को अपडेट किया गया.
[[["समझने में आसान है","easyToUnderstand","thumb-up"],["मेरी समस्या हल हो गई","solvedMyProblem","thumb-up"],["अन्य","otherUp","thumb-up"]],[["वह जानकारी मौजूद नहीं है जो मुझे चाहिए","missingTheInformationINeed","thumb-down"],["बहुत मुश्किल है / बहुत सारे चरण हैं","tooComplicatedTooManySteps","thumb-down"],["पुराना","outOfDate","thumb-down"],["अनुवाद से जुड़ी समस्या","translationIssue","thumb-down"],["सैंपल / कोड से जुड़ी समस्या","samplesCodeIssue","thumb-down"],["अन्य","otherDown","thumb-down"]],["आखिरी बार 2025-07-25 (UTC) को अपडेट किया गया."],[],["The `getFastTextWidth` function calculates the width of an SVG text element more quickly than `getTextWidth`. It requires the text element, its font size, weight, and family as inputs. The function takes an SVG `text` element, `fontSize` (number), `fontWeight` (string), and `fontFamily` (string). It returns the element's width as a number, caching computed widths for efficiency.\n"]]