Skip to content

Commit

Permalink
Fix NBSP support. Closes: #834.
Browse files Browse the repository at this point in the history
  • Loading branch information
rysson committed Sep 2, 2023
1 parent b74a590 commit 467509d
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions fpdf/line_break.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
SOFT_HYPHEN = "\u00ad"
HYPHEN = "\u002d"
SPACE = " "
NBSP = "\u00a0"
NEWLINE = "\n"


Expand Down Expand Up @@ -401,6 +402,10 @@ def add_character(
self.number_of_spaces,
)
self.number_of_spaces += 1
elif character == NBSP:
# PDF viewers ignore NBSP for word spacing with "Tw".
character = SPACE
self.number_of_spaces += 1
elif character == SOFT_HYPHEN and not self.print_sh:
self.hyphen_break_hint = HyphenHint(
original_fragment_index,
Expand Down

0 comments on commit 467509d

Please sign in to comment.