Skip to content

Commit

Permalink
fix font name resolution in text_size() function #1236
Browse files Browse the repository at this point in the history
  • Loading branch information
mozman committed Feb 5, 2025
1 parent 083607b commit f4332b2
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 2 additions & 0 deletions notes/pages/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
- {{issue 1219}}
- BUGFIX: `pickle` support added by #mbway
- {{issue 1231}}
- BUGFIX: fix font name resolution in `ezdxf.tools.text_size()` function
- {{issue 1236}}
- ## Version 1.3.5 - 2024-12-15
- ((65ed4f6c-edc8-4390-880c-c604a3fa5ec0))
- NEW: `ezdxf.blkrefs.find_unreferenced_blocks()` function returns the names of unused block definitions
Expand Down
3 changes: 1 addition & 2 deletions src/ezdxf/tools/text_size.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,7 @@ def text_size(text: Text) -> TextSize:
cap_height: float = text.dxf.get_default("height")
font: fonts.AbstractFont = fonts.MonospaceFont(cap_height, width_factor)
if text.doc is not None:
style = text.doc.styles.get(text.dxf.get_default("style"))
font_name = get_font_name(style)
font_name = get_font_name(text)
font = fonts.make_font(font_name, cap_height, width_factor)

total_height = font.measurements.total_height
Expand Down

0 comments on commit f4332b2

Please sign in to comment.