@@ -455,6 +455,38 @@ def X6a(self, idx):
455455
456456 self .chars [idx ]['level' ] = self .last_level_entry .embedding_level
457457
458+ def X7 (self , idx ):
459+ """X7_, With each PDF, perform the following steps:
460+
461+ * If the overflow isolate count is greater than zero, do nothing. (This
462+ PDF is within the scope of an overflow isolate initiator. It either
463+ matches and terminates the scope of an overflow embedding initiator
464+ within that overflow isolate, or does not match any embedding
465+ initiator.)
466+ * Otherwise, if the overflow embedding count is greater than zero,
467+ decrement it by one. (This PDF matches and terminates the scope of an
468+ overflow embedding initiator that is not within the scope of an
469+ overflow isolate initiator.)
470+ * Otherwise, if the directional isolate status of the last entry on the
471+ directional status stack is false, and the directional status stack
472+ contains at least two entries, pop the last entry from the
473+ directional status stack. (This PDF matches and terminates the scope
474+ of a valid embedding initiator. Since the stack has at least two
475+ entries, this pop does not leave the stack empty.)
476+ * Otherwise, do nothing. (This PDF does not match any embedding
477+ initiator.)
478+
479+ .. _X7: http://www.unicode.org/reports/tr9/#X7
480+ """
481+
482+ if self .overflow_isolate_count == 0 :
483+
484+ if self .overflow_embedding_count > 0 :
485+ self .overflow_embedding_count -= 1
486+ elif (not self .last_level_entry .directional_isolate
487+ and len (self .levels_stack ) > 1 ):
488+ self .pop_levels_entry ()
489+
458490 def explicit_levels_and_directions (self ):
459491
460492 MAPPINGS = {
@@ -478,7 +510,7 @@ def explicit_levels_and_directions(self):
478510 method (idx )
479511 else :
480512 if ch_type not in ('BN' , 'B' ):
481- self .X6 (ch )
513+ self .X6 (idx )
482514
483515 @property
484516 def display (self ):
0 commit comments