From b4d1500adf0a3d480b3017535cb224ac83fe51bf Mon Sep 17 00:00:00 2001 From: Vardhan Date: Sun, 13 Sep 2015 21:24:17 +0530 Subject: [PATCH 1/3] Adding Private Unicode Area to Unicode map for Bullet character Adding few bullet types that word uses. --- source/NVDAObjects/window/winword.py | 21 +++++++++++++++++++++ source/locale/en/symbols.dic | 4 ++++ 2 files changed, 25 insertions(+) diff --git a/source/NVDAObjects/window/winword.py b/source/NVDAObjects/window/winword.py index 6ef72b491a4..bbb53c52adc 100755 --- a/source/NVDAObjects/window/winword.py +++ b/source/NVDAObjects/window/winword.py @@ -257,6 +257,23 @@ } formatConfigFlag_includeLayoutTables=131072 + +##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 + +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) +} + + class WordDocumentHeadingQuickNavItem(browseMode.TextInfoQuickNavItem): def __init__(self,nodeType,document,textInfo,level): @@ -633,6 +650,10 @@ def _normalizeFormatField(self,field,extraDetail=False): # Translators: the value in points for a paragraph indenting v=_("%g pt") % 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) return field def _getLanguageFromLcid(self, lcid): diff --git a/source/locale/en/symbols.dic b/source/locale/en/symbols.dic index 24be9a7f5fb..abf55547031 100644 --- a/source/locale/en/symbols.dic +++ b/source/locale/en/symbols.dic @@ -97,6 +97,10 @@ _ line most ◾ black square some ◦ white bullet some ➔ right arrow some +⇨ right arrow hollow some +➢ right arrow head some +❖ Black diamond minus white X some +♦ black diamond some § section all ° degrees some « double left pointing angle bracket From 4a717d63b66499dfc8ed7d306d57d81788a4b672 Mon Sep 17 00:00:00 2001 From: Davy Kager Date: Sat, 21 Jan 2017 20:37:37 +0100 Subject: [PATCH 2/3] 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. --- source/NVDAObjects/window/winword.py | 34 +++++++++++++--------------- source/locale/en/symbols.dic | 10 ++++---- 2 files changed, 21 insertions(+), 23 deletions(-) diff --git a/source/NVDAObjects/window/winword.py b/source/NVDAObjects/window/winword.py index 3b75ae4109e..da7e9595330 100755 --- a/source/NVDAObjects/window/winword.py +++ b/source/NVDAObjects/window/winword.py @@ -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): @@ -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 + field['line-prefix']=mapPUAToUnicode.get(bullet,bullet) return field def expand(self,unit): diff --git a/source/locale/en/symbols.dic b/source/locale/en/symbols.dic index 3ef4b9ce9e0..74400f75a5c 100644 --- a/source/locale/en/symbols.dic +++ b/source/locale/en/symbols.dic @@ -82,7 +82,6 @@ _ line most • bullet some … dot dot dot all always ... dot dot dot all always - bullet some “ left quote most ” right quote most ‘ left tick most @@ -97,10 +96,11 @@ _ line most ▪ black square some ◾ black square some ◦ white bullet some -➔ right arrow some -⇨ 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 From f05da7fb1f811e3325c4ee5e11b51b5b74a763e3 Mon Sep 17 00:00:00 2001 From: Davy Kager Date: Mon, 26 Jun 2017 19:32:55 +0200 Subject: [PATCH 3/3] Review actions. --- source/NVDAObjects/window/winword.py | 1 - 1 file changed, 1 deletion(-) diff --git a/source/NVDAObjects/window/winword.py b/source/NVDAObjects/window/winword.py index c3365072953..d2dd16e2d03 100755 --- a/source/NVDAObjects/window/winword.py +++ b/source/NVDAObjects/window/winword.py @@ -808,7 +808,6 @@ def _normalizeFormatField(self,field,extraDetail=False): field[x]=v bullet=field.get('line-prefix') if bullet and len(bullet)==1: - global mapPUAToUnicode field['line-prefix']=mapPUAToUnicode.get(bullet,bullet) return field