@@ -387,7 +387,6 @@ class TextArea(BaseComponent):
387
387
is_text_centered : bool = True
388
388
supersampling_factor : int = 2 # 1 = disabled; 2 = default, double sample (4px square rendered for 1px)
389
389
auto_line_break : bool = True
390
- allow_text_overflow : bool = False
391
390
is_horizontal_scrolling_enabled : bool = False
392
391
horizontal_scroll_speed : int = 40 # px per sec
393
392
horizontal_scroll_begin_hold_secs : float = 2.0
@@ -399,10 +398,6 @@ def __post_init__(self):
399
398
if self .is_horizontal_scrolling_enabled and self .auto_line_break :
400
399
raise Exception ("TextArea: Cannot have auto_line_break and horizontal scrolling enabled at the same time" )
401
400
402
- if self .is_horizontal_scrolling_enabled and not self .allow_text_overflow :
403
- self .allow_text_overflow = True
404
- logger .warning ("TextArea: allow_text_overflow gets overridden to True when horizontal scrolling is enabled" )
405
-
406
401
if not self .font_name :
407
402
self .font_name = GUIConstants .get_body_font_name ()
408
403
if not self .font_size :
@@ -459,7 +454,6 @@ def __post_init__(self):
459
454
width = self .width - 2 * self .edge_padding ,
460
455
font_name = self .font_name ,
461
456
font_size = self .font_size ,
462
- allow_text_overflow = self .allow_text_overflow ,
463
457
)
464
458
465
459
# Other components, like IconTextLine will need to know how wide the actual
@@ -486,14 +480,9 @@ def __post_init__(self):
486
480
487
481
else :
488
482
if total_text_height > self .height :
489
- if not self .allow_text_overflow :
490
- # For now, early into the l10n rollout, we can't enforce strict
491
- # conformance here. Too many screens will just break if this is were
492
- # to raise an exception.
493
- logger .warning (f"Text cannot fit in target rect with this font/size\n \t total_text_height: { total_text_height } | self.height: { self .height } " )
494
- else :
495
- # Just let it render past the bottom edge
496
- pass
483
+ # Let it render past the bottom edge. Will be up to the dev or translator
484
+ # to review the screenshot and revise the text as needed.
485
+ logger .warning (f"Text cannot fit in target rect with this font/size\n \t total_text_height: { total_text_height } | self.height: { self .height } " )
497
486
498
487
else :
499
488
# Vertically center the text's starting point
@@ -746,7 +735,6 @@ class ScrollableTextLine(TextArea):
746
735
def __post_init__ (self ):
747
736
self .auto_line_break = False
748
737
self .is_horizontal_scrolling_enabled = True
749
- self .allow_text_overflow = True
750
738
super ().__post_init__ ()
751
739
752
740
@@ -808,7 +796,6 @@ class IconTextLine(BaseComponent):
808
796
font_size : int = None
809
797
is_text_centered : bool = False
810
798
auto_line_break : bool = False
811
- allow_text_overflow : bool = True
812
799
screen_x : int = 0
813
800
screen_y : int = 0
814
801
@@ -851,7 +838,6 @@ def __post_init__(self):
851
838
auto_line_break = False ,
852
839
screen_x = text_screen_x ,
853
840
screen_y = self .screen_y ,
854
- allow_text_overflow = False ,
855
841
)
856
842
else :
857
843
self .label_textarea = None
@@ -871,7 +857,6 @@ def __post_init__(self):
871
857
edge_padding = 0 ,
872
858
is_text_centered = self .is_text_centered if not self .icon_name else False ,
873
859
auto_line_break = self .auto_line_break ,
874
- allow_text_overflow = self .allow_text_overflow ,
875
860
screen_x = text_screen_x ,
876
861
screen_y = value_textarea_screen_y ,
877
862
)
@@ -1521,7 +1506,6 @@ def __post_init__(self):
1521
1506
button_kwargs ["text" ] = self .text
1522
1507
button_kwargs ["font_color" ] = self .font_color
1523
1508
button_kwargs ["background_color" ] = self .background_color
1524
- button_kwargs ["allow_text_overflow" ] = True
1525
1509
button_kwargs ["auto_line_break" ] = False
1526
1510
del button_kwargs ["horizontal_scroll_begin_hold_secs" ]
1527
1511
del button_kwargs ["horizontal_scroll_end_hold_secs" ]
@@ -1826,8 +1810,7 @@ def calc_bezier_curve(p1: Tuple[int,int], p2: Tuple[int,int], p3: Tuple[int,int]
1826
1810
def reflow_text_for_width (text : str ,
1827
1811
width : int ,
1828
1812
font_name = GUIConstants .get_body_font_name (),
1829
- font_size = GUIConstants .get_body_font_size (),
1830
- allow_text_overflow : bool = False ) -> list [dict ]:
1813
+ font_size = GUIConstants .get_body_font_size ()) -> list [dict ]:
1831
1814
"""
1832
1815
Reflows text to fit within `width` by breaking long lines up.
1833
1816
@@ -1854,9 +1837,6 @@ def reflow_text_for_width(text: str,
1854
1837
SettingsConstants .LOCALE__JAPANESE ,
1855
1838
SettingsConstants .LOCALE__KOREAN ,
1856
1839
]
1857
- if treat_chars_as_words :
1858
- # Relax UI constraints even if the result isn't optimal
1859
- allow_text_overflow = True
1860
1840
1861
1841
# Stores each line of text and its rendering starting x-coord
1862
1842
text_lines = []
@@ -1904,9 +1884,9 @@ def _binary_len_search(min_index, max_index, word_spacer):
1904
1884
# Candidate line is possibly shorter than necessary.
1905
1885
return _binary_len_search (min_index = index , max_index = max_index , word_spacer = word_spacer )
1906
1886
1907
- if len (text .split ()) == 1 and not allow_text_overflow and not treat_chars_as_words :
1908
- # No whitespace chars to split on!
1909
- raise TextDoesNotFitException ("Text cannot fit in target rect with this font+size" )
1887
+ if len (text .split ()) == 1 and not treat_chars_as_words :
1888
+ # No whitespace chars to split on! Warn but proceed anyway.
1889
+ logger . warning ("Text cannot fit in target rect with this font+size" )
1910
1890
1911
1891
# Now we're ready to go line-by-line into our line break binary search!
1912
1892
for line in text .split ("\n " ):
@@ -1946,8 +1926,7 @@ def reflow_text_into_pages(text: str,
1946
1926
height : int ,
1947
1927
font_name = GUIConstants .get_body_font_name (),
1948
1928
font_size = GUIConstants .get_body_font_size (),
1949
- line_spacer : int = GUIConstants .BODY_LINE_SPACING ,
1950
- allow_text_overflow : bool = False ) -> list [str ]:
1929
+ line_spacer : int = GUIConstants .BODY_LINE_SPACING ) -> list [str ]:
1951
1930
"""
1952
1931
Invokes `reflow_text_for_width` above to convert long text into width-limited
1953
1932
individual text lines and then calculates how many lines will fit on a "page" and
@@ -1958,8 +1937,7 @@ def reflow_text_into_pages(text: str,
1958
1937
reflowed_lines_dicts = reflow_text_for_width (text = text ,
1959
1938
width = width ,
1960
1939
font_name = font_name ,
1961
- font_size = font_size ,
1962
- allow_text_overflow = allow_text_overflow )
1940
+ font_size = font_size )
1963
1941
1964
1942
lines = []
1965
1943
for line_dict in reflowed_lines_dicts :
0 commit comments