tools/font_export/invalid.py
#!/usr/bin/python
# -*- coding: latin-1 -*-
import os
import shutil
import glob
import string
from bs4 import BeautifulSoup
from characters import CHARS
from vertical import VERTICAL_OFFSET
SVG_PATH = "svg"
OUT_PATH = "font"
OUT_NAME = ".txt"
def uconvert( value ):
return str( ord( value ) )
def gconvert( value ):
return "".join( value.split("_") )
def filter_fonts():
files = glob.glob( OUT_PATH + os.sep + '*.txt' )
#target = 8
#target_count = 0
font_id = ""
fonts = {}
for i in files:
font_keys = { '33':False }
font_data = open( i , 'r' ).read()
lines = font_data.split("\n")
print( i )
font_has_33 = False #!
font_has_34 = False #double
font_has_35 = False ##
font_has_36 = False #$
font_has_37 = False #percent
font_has_38 = False #&
font_has_39 = False #single
font_has_40 = False #(
font_has_41 = False #)
font_has_42 = False #*
font_has_43 = False #plus
font_has_44 = False #,
font_has_46 = False #.
font_has_47 = False #/
font_has_48 = False #0
font_has_49 = False #1
font_has_50 = False #2
font_has_51 = False #3
font_has_52 = False #4
font_has_53 = False #5
font_has_54 = False #6
font_has_55 = False #7
font_has_56 = False #8
font_has_57 = False #9
font_has_58 = False #:
font_has_59 = False #;
font_has_60 = False #<
font_has_61 = False #equals
font_has_62 = False #>
font_has_63 = False #?
font_has_64 = False #@
font_has_65 = False #A
font_has_66 = False #B
font_has_67 = False #C
font_has_68 = False #D
font_has_69 = False #E
font_has_70 = False #F
font_has_71 = False #G
font_has_72 = False #H
font_has_73 = False #I
font_has_74 = False #J
font_has_75 = False #K
font_has_76 = False #L
font_has_77 = False #M
font_has_78 = False #N
font_has_79 = False #O
font_has_80 = False #P
font_has_81 = False #Q
font_has_82 = False #R
font_has_83 = False #S
font_has_84 = False #T
font_has_85 = False #U
font_has_86 = False #V
font_has_87 = False #W
font_has_88 = False #X
font_has_89 = False #Y
font_has_90 = False #Z
font_has_91 = False #[
font_has_92 = False #\
font_has_93 = False #]
font_has_94 = False #^
font_has_95 = False #_
font_has_96 = False #backtick
font_has_97 = False #a
font_has_98 = False #b
font_has_99 = False #c
font_has_100 = False #d
font_has_101 = False #e
font_has_102 = False #f
font_has_103 = False #g
font_has_104 = False #h
font_has_105 = False #i
font_has_106 = False #j
font_has_107 = False #k
font_has_108 = False #l
font_has_109 = False #m
font_has_110 = False #n
font_has_111 = False #o
font_has_112 = False #p
font_has_113 = False #q
font_has_114 = False #r
font_has_115 = False #s
font_has_116 = False #t
font_has_117 = False #u
font_has_118 = False #v
font_has_119 = False #w
font_has_120 = False #x
font_has_121 = False #y
font_has_122 = False #z
font_has_123 = False #{
font_has_124 = False #|
font_has_125 = False #}
font_has_126 = False #~
font_has_8216 = False #single left
font_has_8217 = False #single right
font_has_8220 = False #double left
font_has_8221 = False #double right
for j in lines:
line = j.split("|")
if line[0] == "1":
if line[1] == '33':
font_has_33 = True #!
if line[1] == '34':
font_has_34 = True #double
if line[1] == '35':
font_has_35 = True ##
if line[1] == '36':
font_has_36 = True #$
if line[1] == '37':
font_has_37 = True #percent
if line[1] == '38':
font_has_38 = True #&
if line[1] == '39':
font_has_39 = True #single
if line[1] == '40':
font_has_40 = True #(
if line[1] == '41':
font_has_41 = True #)
if line[1] == '42':
font_has_42 = True #*
if line[1] == '43':
font_has_43 = True #plus
if line[1] == '44':
font_has_44 = True #,
if line[1] == '46':
font_has_46 = True #.
if line[1] == '47':
font_has_47 = True #/
if line[1] == '48':
font_has_48 = True #0
if line[1] == '49':
font_has_49 = True #1
if line[1] == '50':
font_has_50 = True #2
if line[1] == '51':
font_has_51 = True #3
if line[1] == '52':
font_has_52 = True #4
if line[1] == '53':
font_has_53 = True #5
if line[1] == '54':
font_has_54 = True #6
if line[1] == '55':
font_has_55 = True #7
if line[1] == '56':
font_has_56 = True #8
if line[1] == '57':
font_has_57 = True #9
if line[1] == '58':
font_has_58 = True #:
if line[1] == '59':
font_has_59 = True #;
if line[1] == '60':
font_has_60 = True #<
if line[1] == '61':
font_has_61 = True #equals
if line[1] == '62':
font_has_62 = True #>
if line[1] == '63':
font_has_63 = True #?
if line[1] == '64':
font_has_64 = True #@
if line[1] == '65':
font_has_65 = True #A
if line[1] == '66':
font_has_66 = True #B
if line[1] == '67':
font_has_67 = True #C
if line[1] == '68':
font_has_68 = True #D
if line[1] == '69':
font_has_69 = True #E
if line[1] == '70':
font_has_70 = True #F
if line[1] == '71':
font_has_71 = True #G
if line[1] == '72':
font_has_72 = True #H
if line[1] == '73':
font_has_73 = True #I
if line[1] == '74':
font_has_74 = True #J
if line[1] == '75':
font_has_75 = True #K
if line[1] == '76':
font_has_76 = True #L
if line[1] == '77':
font_has_77 = True #M
if line[1] == '78':
font_has_78 = True #N
if line[1] == '79':
font_has_79 = True #O
if line[1] == '80':
font_has_80 = True #P
if line[1] == '81':
font_has_81 = True #Q
if line[1] == '82':
font_has_82 = True #R
if line[1] == '83':
font_has_83 = True #S
if line[1] == '84':
font_has_84 = True #T
if line[1] == '85':
font_has_85 = True #U
if line[1] == '86':
font_has_86 = True #V
if line[1] == '87':
font_has_87 = True #W
if line[1] == '88':
font_has_88 = True #X
if line[1] == '89':
font_has_89 = True #Y
if line[1] == '90':
font_has_90 = True #Z
if line[1] == '91':
font_has_91 = True #[
if line[1] == '92':
font_has_92 = True #\
if line[1] == '93':
font_has_93 = True #]
if line[1] == '94':
font_has_94 = True #^
if line[1] == '95':
font_has_95 = True #_
if line[1] == '96':
font_has_96 = True #backtick
if line[1] == '97':
font_has_97 = True #a
if line[1] == '98':
font_has_98 = True #b
if line[1] == '99':
font_has_99 = True #c
if line[1] == '100':
font_has_100 = True #d
if line[1] == '101':
font_has_101 = True #e
if line[1] == '102':
font_has_102 = True #f
if line[1] == '103':
font_has_103 = True #g
if line[1] == '104':
font_has_104 = True #h
if line[1] == '105':
font_has_105 = True #i
if line[1] == '106':
font_has_106 = True #j
if line[1] == '107':
font_has_107 = True #k
if line[1] == '108':
font_has_108 = True #l
if line[1] == '109':
font_has_109 = True #m
if line[1] == '110':
font_has_110 = True #n
if line[1] == '111':
font_has_111 = True #o
if line[1] == '112':
font_has_112 = True #p
if line[1] == '113':
font_has_113 = True #q
if line[1] == '114':
font_has_114 = True #r
if line[1] == '115':
font_has_115 = True #s
if line[1] == '116':
font_has_116 = True #t
if line[1] == '117':
font_has_117 = True #u
if line[1] == '118':
font_has_118 = True #v
if line[1] == '119':
font_has_119 = True #w
if line[1] == '120':
font_has_120 = True #x
if line[1] == '121':
font_has_121 = True #y
if line[1] == '122':
font_has_122 = True #z
if line[1] == '123':
font_has_123 = True #{
if line[1] == '124':
font_has_124 = True #|
if line[1] == '125':
font_has_125 = True #}
if line[1] == '126':
font_has_126 = True #~
if line[1] == '8216':
font_has_8216 = True #single left
if line[1] == '8217':
font_has_8217 = True #single right
if line[1] == '8220':
font_has_8220 = True #double left
if line[1] == '8221':
font_has_8221 = True #double right
if font_has_33 == False:
print( ' Missing: 33' )
if font_has_34 == False:
print("Missing: 34 double ")
if font_has_35 == False:
print("Missing: 35 # ")
if font_has_36 == False:
print("Missing: 36 $ ")
if font_has_37 == False:
print("Missing: 37 percent ")
if font_has_38 == False:
print("Missing: 38 & ")
if font_has_39 == False:
print("Missing: 39 single ")
if font_has_40 == False:
print("Missing: 40 ( ")
if font_has_41 == False:
print("Missing: 41 ) ")
if font_has_42 == False:
print("Missing: 42 * ")
if font_has_43 == False:
print("Missing: 43 plus ")
if font_has_44 == False:
print("Missing: 44 , ")
if font_has_46 == False:
print("Missing: 46 . ")
if font_has_47 == False:
print("Missing: 47 / ")
if font_has_48 == False:
print("Missing: 48 0 ")
if font_has_49 == False:
print("Missing: 49 1 ")
if font_has_50 == False:
print("Missing: 50 2 ")
if font_has_51 == False:
print("Missing: 51 3 ")
if font_has_52 == False:
print("Missing: 52 4 ")
if font_has_53 == False:
print("Missing: 53 5 ")
if font_has_54 == False:
print("Missing: 54 6 ")
if font_has_55 == False:
print("Missing: 55 7 ")
if font_has_56 == False:
print("Missing: 56 8 ")
if font_has_57 == False:
print("Missing: 57 9 ")
if font_has_58 == False:
print("Missing: 58 : ")
if font_has_59 == False:
print("Missing: 59 ; ")
if font_has_60 == False:
print("Missing: 60 < ")
if font_has_61 == False:
print("Missing: 61 equals ")
if font_has_62 == False:
print("Missing: 62 > ")
if font_has_63 == False:
print("Missing: 63 ? ")
if font_has_64 == False:
print("Missing: 64 @ ")
if font_has_65 == False:
print("Missing: 65 A ")
if font_has_66 == False:
print("Missing: 66 B ")
if font_has_67 == False:
print("Missing: 67 C ")
if font_has_68 == False:
print("Missing: 68 D ")
if font_has_69 == False:
print("Missing: 69 E ")
if font_has_70 == False:
print("Missing: 70 F ")
if font_has_71 == False:
print("Missing: 71 G ")
if font_has_72 == False:
print("Missing: 72 H ")
if font_has_73 == False:
print("Missing: 73 I ")
if font_has_74 == False:
print("Missing: 74 J ")
if font_has_75 == False:
print("Missing: 75 K ")
if font_has_76 == False:
print("Missing: 76 L ")
if font_has_77 == False:
print("Missing: 77 M ")
if font_has_78 == False:
print("Missing: 78 N ")
if font_has_79 == False:
print("Missing: 79 O ")
if font_has_80 == False:
print("Missing: 80 P ")
if font_has_81 == False:
print("Missing: 81 Q ")
if font_has_82 == False:
print("Missing: 82 R ")
if font_has_83 == False:
print("Missing: 83 S ")
if font_has_84 == False:
print("Missing: 84 T ")
if font_has_85 == False:
print("Missing: 85 U ")
if font_has_86 == False:
print("Missing: 86 V ")
if font_has_87 == False:
print("Missing: 87 W ")
if font_has_88 == False:
print("Missing: 88 X ")
if font_has_89 == False:
print("Missing: 89 Y ")
if font_has_90 == False:
print("Missing: 90 Z ")
if font_has_91 == False:
print("Missing: 91 [ ")
if font_has_92 == False:
print("Missing: 92 \ ")
if font_has_93 == False:
print("Missing: 93 ] ")
if font_has_94 == False:
print("Missing: 94 ^ ")
if font_has_95 == False:
print("Missing: 95 _ ")
if font_has_96 == False:
print("Missing: 96 backtick ")
if font_has_97 == False:
print("Missing: 97 a ")
if font_has_98 == False:
print("Missing: 98 b ")
if font_has_99 == False:
print("Missing: 99 c ")
if font_has_100 == False:
print("Missing: 100 d ")
if font_has_101 == False:
print("Missing: 101 e ")
if font_has_102 == False:
print("Missing: 102 f ")
if font_has_103 == False:
print("Missing: 103 g ")
if font_has_104 == False:
print("Missing: 104 h ")
if font_has_105 == False:
print("Missing: 105 i ")
if font_has_106 == False:
print("Missing: 106 j ")
if font_has_107 == False:
print("Missing: 107 k ")
if font_has_108 == False:
print("Missing: 108 l ")
if font_has_109 == False:
print("Missing: 109 m ")
if font_has_110 == False:
print("Missing: 110 n ")
if font_has_111 == False:
print("Missing: 111 o ")
if font_has_112 == False:
print("Missing: 112 p ")
if font_has_113 == False:
print("Missing: 113 q ")
if font_has_114 == False:
print("Missing: 114 r ")
if font_has_115 == False:
print("Missing: 115 s ")
if font_has_116 == False:
print("Missing: 116 t ")
if font_has_117 == False:
print("Missing: 117 u ")
if font_has_118 == False:
print("Missing: 118 v ")
if font_has_119 == False:
print("Missing: 119 w ")
if font_has_120 == False:
print("Missing: 120 x ")
if font_has_121 == False:
print("Missing: 121 y ")
if font_has_122 == False:
print("Missing: 122 z ")
if font_has_123 == False:
print("Missing: 123 { ")
if font_has_124 == False:
print("Missing: 124 | ")
if font_has_125 == False:
print("Missing: 125 } ")
if font_has_126 == False:
print("Missing: 126 ~ ")
if font_has_8216 == False:
print("Missing: 8216 single left ")
if font_has_8217 == False:
print("Missing: 8217 single right ")
if font_has_8220 == False:
print("Missing: 8220 double left ")
if font_has_8221 == False:
print("Missing: 8221 double right ")
filter_fonts()