measure_text — ANNOTATE text op

• Data kinds: text → table

• Call: import fullseye as fs; fs.ledger.measure_text(text, font_size=14, font_path=None, max_width=None, min_font_size=9, line_spacing=1.15, wrap=True, bold=False, italic=False) (implementation को सीधे call करना हो तो import annotate; annotate.measure_text(text, font_size=14, font_path=None, max_width=None, min_font_size=9, line_spacing=1.15, wrap=True, bold=False, italic=False), registry से लेना हो तो opsannotate.get("measure_text"))

उपयोग

text को बनाने से पहले मापता है। न समाए तो wrap करता है या छोटा करता है, फिर भी न हो तो exception।

Parameters

text : str

मापी जाने वाली string (\n से line break)।

font_size : int

इच्छित size। max_width में न समाए तो 1pt करके छोटा किया जाता है।

font_path : str or None

स्पष्ट रूप से देने पर अलग-अलग machines पर भी एक जैसा परिणाम मिलता है। None पर FONT_CANDIDATES

को तय क्रम में खोजा जाता है।

max_width : int or None

जिस width [px] में समाना है। None हो तो न छोटा करता है, न wrap करता है।

min_font_size : int

यहाँ तक छोटा करने पर भी न समाए तो ValueError (चुपचाप काटता नहीं)।

line_spacing : float

line spacing factor।

bold, italic : bool or int

synthetic bold और italic (_bold_px / _italic_tile)। ये असली

Bold / Italic typeface नहीं हैं, इसलिए glyph की आकृति अलग होती है -- असली चाहिए तो

font_path में उस typeface की file दें। bold में integer देने पर

overstrike की संख्या सीधे तय की जा सकती है। मोटाई और झुकाव का हिस्सा width में जुड़ता है,

इसलिए plate और table के column उतने ही चौड़े होते हैं (overstrike केवल horizontal मोटा करता है, इसलिए

height नहीं बदलता)।

wrap : bool

True (default) हो तो max_width पर wrap करता है। False हो तो wrap नहीं करता बल्कि

lines बढ़ाए बिना font छोटा करके समाता है (grid labels की तरह, जहाँ 2 lines

होने पर layout बिगड़ जाता है -- exhibit_tile._fit_label जैसा ही तरीका)।

दोनों में min_font_size तक पहुँचकर भी न समाए तो exception।

\n वाला line break max_width हो या न हो, wrap का मान कुछ भी हो, इससे स्वतंत्र हमेशा लागू होता है

(width न देने पर सब 1 line में दब जाए, ऐसी दुर्घटना नहीं होती)।

Returns

dict

{"lines", "font", "font_size", "width", "height", "line_height"}।

width/height measured [px] हैं।

Raises

ValueError

max_width positive नहीं / min_font_size तक छोटा करने पर भी 1 line नहीं समाती।

उपयोग की विस्तृत guide

• figure_annotation family guide

पृष्ठभूमि guides (इस op के पीछे की physics और conventions)

• dataset_conventions — Training dataset के conventions — COCO / YOLO / VOC और visual inspection में सावधानियाँ

संदर्भ (sample data, साहित्य)

• Sample data catalog (DL URL / license) — 2-D के लिए skimage.data (BSD/public) + synthetic, 3-D के लिए real data sources (Stanford/PDS आदि) के DL URL।

• Operators का स्रोत और संदर्भ — इस op family के मूल research/methods के स्रोत।

• Algorithm का मानक स्रोत (लेखक, वर्ष) और उपयोग ऊपर की family usage guide में दिए गए हैं।

चलाए जा सकने वाले उदाहरण (verified samples जो सच में यह op call करते हैं)

• annotate_gallery — py -3.11 examples/annotate_gallery.py

• annotate_paper_tour — py -3.11 examples/annotate_paper_tour.py

• poc_diabolo_model_and_vision — py -3.11 examples/poc_diabolo_model_and_vision.py

वे अगले ops जिनसे type जुड़ता है (table को input के रूप में लेते हैं)

—

इसी category के (text)

text_box


*Provenance: annotate.py — ANNOTATE operator registry. यह per-op note tools/opdocs.py md से अपने-आप generate होता है (हाथ से edit न करें)।*

© 2026 Kazufumi Furuse — Fullseye operator documentation. Licensed under Apache-2.0.