Skip to content

Commit

Permalink
Workaround for issue #27: exclude duplicate Material Design 'flouresc…
Browse files Browse the repository at this point in the history
…ent ec31'. In Go the workaround now uses "Flourescent" code "\xef\x80\x8d" instead of "\xee\xb0\xb1" which is a duplicate.
  • Loading branch information
juliettef committed Jan 11, 2023
1 parent 34a7a35 commit f89053d
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 28 deletions.
42 changes: 18 additions & 24 deletions GenerateIconFontCppHeaders.py
Expand Up @@ -311,20 +311,23 @@ def get_icons( cls, input_data ):
font_max_int = int( font_max, 16 )
icons = []
for line in lines :
words = str.split(line)
if words and len( words ) >= 2:
word_unicode = words[ 1 ].zfill( 4 )
word_int = int( word_unicode, 16 )
if word_int < font_min_int and word_int > 0x0127 : # exclude ASCII characters code points
font_min = word_unicode
font_min_int = word_int
if word_int > font_max_16_int and word_int <= 0xffff: # exclude code points > 16 bits
font_max_16 = word_unicode
font_max_16_int = word_int
if word_int > font_max_int:
font_max = word_unicode
font_max_int = word_int
icons.append( words )
if line != 'flourescent ec31': # Excluding duplicate Material Design 'flourescent ec31' as a workaround for issue #27 https://github.com/juliettef/IconFontCppHeaders/issues/27
words = str.split(line)
if words and len( words ) >= 2:
word_unicode = words[ 1 ].zfill( 4 )
word_int = int( word_unicode, 16 )
if word_int < font_min_int and word_int > 0x0127 : # exclude ASCII characters code points
font_min = word_unicode
font_min_int = word_int
if word_int > font_max_16_int and word_int <= 0xffff: # exclude code points > 16 bits
font_max_16 = word_unicode
font_max_16_int = word_int
if word_int > font_max_int:
font_max = word_unicode
font_max_int = word_int
icons.append( words )
else:
print( "[ WARNING - Excluding duplicate Material Design 'flourescent ec31' as a workaround for issue #27 https://github.com/juliettef/IconFontCppHeaders/issues/27 ]" )
icons_data.update({ 'font_min' : font_min,
'font_max_16' : font_max_16,
'font_max' : font_max,
Expand Down Expand Up @@ -599,7 +602,6 @@ def epilogue( cls ):

@classmethod
def line_icon( cls, icon ):

tmpl_line_icon = ' public const string {icon} = "\\u{code}";\n'
icon_name = cls.to_camelcase( icon[ 0 ])
icon_code = icon[ 1 ]
Expand Down Expand Up @@ -671,7 +673,6 @@ def prelude( cls ):
'// from {font_data}\n' + \
'// for use with {ttf_files}\n\n' + \
'package IconFontCppHeaders\n\n'
cls.seen = set()
ttf_files = []
for ttf in cls.intermediate.get( 'ttfs' ):
ttf_files.append( ttf[ 2 ])
Expand Down Expand Up @@ -704,14 +705,7 @@ def prelude( cls ):

@classmethod
def line_icon( cls, icon ):
icon_name = cls.to_camelcase(icon[ 0 ])
# Material Design has multiple "Flourescent" entries; should we be prefixing them
# with something to disambiguate them? For now just keep the first one of any
# such repeats
if icon_name in cls.seen:
print( ' [ WARNING: ignoring duplicate {icon} in {name} ]'.format( icon = icon_name, name = cls.file_name ) )
return ""
cls.seen.add(icon_name)
icon_name = cls.to_camelcase( icon[ 0 ])
tmpl_line_icon = '\t\t"{icon}":\t"{code}", \t// U+{unicode}\n'
icon_code = repr( chr( int( icon[ 1 ], 16 )).encode( 'utf-8' ))[ 2:-1 ]
result = tmpl_line_icon.format( abbr = cls.intermediate.get( 'font_abbr' ),
Expand Down
1 change: 0 additions & 1 deletion IconsMaterialDesign.cs
Expand Up @@ -826,7 +826,6 @@ public class MaterialDesign
public const string Flip_to_back = "\ue882";
public const string Flip_to_front = "\ue883";
public const string Flood = "\uebe6";
public const string Flourescent = "\uec31";
public const string Flourescent = "\uf00d";
public const string Fluorescent = "\uec31";
public const string Flutter_dash = "\ue00b";
Expand Down
2 changes: 1 addition & 1 deletion IconsMaterialDesign.go
Expand Up @@ -828,7 +828,7 @@ var IconsMaterialDesign = Font{
"Flip_to_back": "\xee\xa2\x82", // U+e882
"Flip_to_front": "\xee\xa2\x83", // U+e883
"Flood": "\xee\xaf\xa6", // U+ebe6
"Flourescent": "\xee\xb0\xb1", // U+ec31
"Flourescent": "\xef\x80\x8d", // U+f00d
"Fluorescent": "\xee\xb0\xb1", // U+ec31
"Flutter_dash": "\xee\x80\x8b", // U+e00b
"Fmd_bad": "\xef\x80\x8e", // U+f00e
Expand Down
1 change: 0 additions & 1 deletion IconsMaterialDesign.h
Expand Up @@ -824,7 +824,6 @@
#define ICON_MD_FLIP_TO_BACK "\xee\xa2\x82" // U+e882
#define ICON_MD_FLIP_TO_FRONT "\xee\xa2\x83" // U+e883
#define ICON_MD_FLOOD "\xee\xaf\xa6" // U+ebe6
#define ICON_MD_FLOURESCENT "\xee\xb0\xb1" // U+ec31
#define ICON_MD_FLOURESCENT "\xef\x80\x8d" // U+f00d
#define ICON_MD_FLUORESCENT "\xee\xb0\xb1" // U+ec31
#define ICON_MD_FLUTTER_DASH "\xee\x80\x8b" // U+e00b
Expand Down
1 change: 0 additions & 1 deletion IconsMaterialDesign.py
Expand Up @@ -823,7 +823,6 @@ class IconsMaterialDesign:
ICON_FLIP_TO_BACK = '\ue882'
ICON_FLIP_TO_FRONT = '\ue883'
ICON_FLOOD = '\uebe6'
ICON_FLOURESCENT = '\uec31'
ICON_FLOURESCENT = '\uf00d'
ICON_FLUORESCENT = '\uec31'
ICON_FLUTTER_DASH = '\ue00b'
Expand Down

0 comments on commit f89053d

Please sign in to comment.