@@ -587,13 +587,28 @@ def _place_text(
587587 # only one accent range can effect a given character
588588 break
589589
590+ if (
591+ not accented
592+ and self ._has_outline_accent ()
593+ or accented
594+ and accent_type == "foreground_background"
595+ ):
596+ y_blit_target += self ._outline_size
597+
590598 if accented :
591- bitmaptools .blit (
592- bitmap ,
593- self ._tmp_glyph_bitmap ,
594- max (xposition + my_glyph .dx , 0 ),
595- y_blit_target ,
596- )
599+ try :
600+ bitmaptools .blit (
601+ bitmap ,
602+ self ._tmp_glyph_bitmap ,
603+ max (xposition + my_glyph .dx , 0 ),
604+ y_blit_target ,
605+ )
606+ except ValueError :
607+ # It's possible to overshoot the width of the bitmap if max_characters
608+ # is enabled and outline is used on at least some of the text.
609+ # In this case just skip any characters that fall outside the
610+ # max_characters box size without accounting for outline size.
611+ pass
597612 else :
598613 try :
599614 self ._blit (
@@ -651,6 +666,12 @@ def _add_outline(self, bitmap):
651666 "Try using either larger padding sizes, or smaller outline_size."
652667 ) from value_error
653668
669+ def _has_outline_accent (self ):
670+ for accent in self ._accent_ranges :
671+ if accent [ACCENT_TYPE ] == "outline" :
672+ return True
673+ return False
674+
654675 def _blit (
655676 self ,
656677 bitmap : displayio .Bitmap , # target bitmap
@@ -777,14 +798,14 @@ def bitmap(self) -> displayio.Bitmap:
777798 """
778799 return self ._bitmap
779800
780- def update (self , force : bool = False ) -> None :
801+ def update (self , force : bool = False ) -> bool :
781802 """Attempt to update the display. If ``animate_time`` has elapsed since
782803 previews animation frame then move the characters over by 1 index.
783804 Must be called in the main loop of user code.
784805
785806 :param bool force: whether to ignore ``animation_time`` and force the update.
786807 Default is False.
787- :return: None
808+ :return: bool updated: whether anything changed and the display needs to be refreshed.
788809 """
789810 _now = adafruit_ticks .ticks_ms ()
790811 if force or adafruit_ticks .ticks_less (
@@ -815,10 +836,13 @@ def update(self, force: bool = False) -> None:
815836
816837 _showing_string = f"{ _showing_string_start } { _showing_string_end } "
817838 self ._set_text (_showing_string , self .scale )
818- self .current_index += 1
839+ if not force :
840+ self .current_index += 1
819841 self ._last_animate_time = _now
820842
821- return
843+ return True
844+
845+ return False
822846
823847 @property
824848 def current_index (self ) -> int :
0 commit comments