Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Clean up PR by @nvda-india:
* Remove U+F0B7 PUA symbol from symbol dictionary.
* Reorder and clean up the mapPUAToUnicode dict.
* More consistent code style in _normalizeFormatField().
* Update U+F0E8 to use the same mapping as Word uses when saving to plain text.
* Update U+F0FC based on http://www.alanwood.net/demos/wingdings.html.
* Update description for U+21E8 to more closely match the Unicode name.
* Add U+F0A7, used for bullets on level 3,
  based on https://en.wikipedia.org/wiki/Symbol_(typeface)#Encoding.
  • Loading branch information
dkager committed Jan 22, 2017
commit 4a717d63b66499dfc8ed7d306d57d81788a4b672
34 changes: 16 additions & 18 deletions source/NVDAObjects/window/winword.py
Original file line number Diff line number Diff line change
Expand Up @@ -324,23 +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.
## Copy of this is in appModules/powerpnt.py

# 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 = {
u'\uF0B7' : u'\u2022', # star to bullet ( Symbol, 0xB7, U+2022, bullet )
u'\uF06E' : u'\u25A0', # double dash to square box ( Wingdings, 0x6E, U+25A0, black square )
u'\uF0E8' : u'\u2794', # minus greater to arrow( Wingdings, 0xE8, U+2794, right arrow solid)
u'\uF0F0' : u'\u21E8', # equal greater to hollow arrow (Wingdings, 0xF0, U+21E8, right arrow hollow)
u'\uF0D8' : u'\u27A2', # reater to arrow head (Wingdings, 0xD8, U+27A2, right arrowhead)
u'\uF0A8' : u'\u2666', # greater less to diamond ( Symbol, 0xA8, U+25C6, Black diamond )
u'\uF076' : u'\u2756', # Black diamond minus white X (Wingdings, 0x76 , U+2756, black dia...)
u'\uF0FC' : u'\u2713', # Check Mark (Wingdings, 0xFC, U+2713,check mark)
# 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 @@ -793,10 +791,10 @@ def _normalizeFormatField(self,field,extraDetail=False):
else:
v=self.obj.getLocalizedMeasurementTextForPointSize(v)
field[x]=v
bullet_string = field.get('line-prefix')
if bullet_string and len(bullet_string) == 1:
global mapPUAToUnicode
field['line-prefix'] = mapPUAToUnicode.get(bullet_string,bullet_string)
bullet=field.get('line-prefix')
if bullet and len(bullet)==1:
global mapPUAToUnicode

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Why this line?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Because that variable lives outside the class.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

On second thought, global is only necessary if you want to modify the value. Unnecessary use of this keyword was in the India code. Fixed.

field['line-prefix']=mapPUAToUnicode.get(bullet,bullet)
return field

def expand(self,unit):
Expand Down
10 changes: 5 additions & 5 deletions source/locale/en/symbols.dic
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ _ line most
• bullet some
… dot dot dot all always
... dot dot dot all always
 bullet some

Copy link
Copy Markdown
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
Copy Markdown
Contributor 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,10 +96,11 @@ _ line most
▪ black square some
◾ black square some
◦ white bullet some
➔ right arrow some

Copy link
Copy Markdown
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
Copy Markdown
Contributor 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
Copy Markdown
Contributor 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 arrow hollow some
➢ right arrow head some
❖ Black diamond minus white X some
⇒ 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
Expand Down