Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Map PUA bullets to Unicode in Word #6778

Merged
merged 6 commits into from Mar 28, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
18 changes: 18 additions & 0 deletions source/NVDAObjects/window/winword.py
Expand Up @@ -324,6 +324,21 @@
}
formatConfigFlag_includeLayoutTables=0x20000

# Map some characters from PUA to Unicode. Meant to be used with bullets only.
# Doesn't care about the actual font, so can give incorrect Unicode in rare cases.
mapPUAToUnicode = {
# from : to # fontname
u'\uF06E' : u'\u25A0', # Wingdings
u'\uF076' : u'\u2756', # Wingdings
u'\uF0A7' : u'\u2663', # Symbol
u'\uF0A8' : u'\u2666', # Symbol
u'\uF0B7' : u'\u2022', # Symbol
u'\uF0D8' : u'\u27A2', # Wingdings
u'\uF0E8' : u'\u21D2', # Wingdings
u'\uF0F0' : u'\u21E8', # Wingdings
u'\uF0FC' : u'\u2714', # Wingdings
}

class WordDocumentHeadingQuickNavItem(browseMode.TextInfoQuickNavItem):

def __init__(self,nodeType,document,textInfo,level):
Expand Down Expand Up @@ -791,6 +806,9 @@ def _normalizeFormatField(self,field,extraDetail=False):
else:
v=self.obj.getLocalizedMeasurementTextForPointSize(v)
field[x]=v
bullet=field.get('line-prefix')
if bullet and len(bullet)==1:
field['line-prefix']=mapPUAToUnicode.get(bullet,bullet)
return field

def expand(self,unit):
Expand Down
8 changes: 6 additions & 2 deletions source/locale/en/symbols.dic
Expand Up @@ -82,7 +82,6 @@ _ line most
• bullet some
… dot dot dot all always
... dot dot dot all always
 bullet some
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WHy this removal?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because it is a PUA character and as such it will only be a bullet in certain applications. For Word this character is now mapped to a proper bullet.

“ left quote most
” right quote most
‘ left tick most
Expand All @@ -97,7 +96,12 @@ _ line most
▪ black square some
◾ black square some
◦ white bullet some
➔ right arrow some
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why this removal?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because U+2794 is not the standard rightwards arrow. IMO the definition was too generic. But if nothing else, it's confusing compared to U+2192.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, that arrow (U+2794) is not used as a bullet shape whereas the other arrows are.

⇒ right double arrow some
⇨ right white arrow some
➢ right arrowhead some
❖ black diamond minus white X some
♣ black club some
♦ black diamond some
§ section all
° degrees some
« double left pointing angle bracket
Expand Down