mirror of
https://github.com/Ralim/IronOS.git
synced 2025-02-26 07:53:55 +00:00
Working small font table
This commit is contained in:
@@ -422,7 +422,7 @@ def getFontMap():
|
|||||||
}
|
}
|
||||||
return font
|
return font
|
||||||
|
|
||||||
def getSmallFontMap():
|
def getSmallFontMap():
|
||||||
font = {
|
font = {
|
||||||
" ":"0x00, 0x00, 0x00, 0x00, 0x00, 0x00,",
|
" ":"0x00, 0x00, 0x00, 0x00, 0x00, 0x00,",
|
||||||
"!":"0x00, 0x00, 0x4f, 0x00, 0x00, 0x00,",
|
"!":"0x00, 0x00, 0x4f, 0x00, 0x00, 0x00,",
|
||||||
@@ -5,7 +5,7 @@ import json
|
|||||||
import os
|
import os
|
||||||
import io
|
import io
|
||||||
import sys
|
import sys
|
||||||
from font import getFontMap
|
import fontTables
|
||||||
TRANSLATION_CPP = "Translation.cpp"
|
TRANSLATION_CPP = "Translation.cpp"
|
||||||
|
|
||||||
try:
|
try:
|
||||||
@@ -140,23 +140,40 @@ def getFontMapAndTable(textList):
|
|||||||
# allocate out these in their order as number codes
|
# allocate out these in their order as number codes
|
||||||
symbolMap = {}
|
symbolMap = {}
|
||||||
index = 1
|
index = 1
|
||||||
|
if len(textList) > 245:
|
||||||
|
print('Error, too many used symbols for this version')
|
||||||
|
exit(1)
|
||||||
|
print('Generating fonts for {} symbols'.format(len(textList)))
|
||||||
for sym in textList:
|
for sym in textList:
|
||||||
symbolMap[sym] = "\\x%0.2X" % index
|
symbolMap[sym] = "\\x%0.2X" % index
|
||||||
index = index + 1
|
index = index + 1
|
||||||
# Get the font table
|
# Get the font table
|
||||||
fontTableStrings = []
|
fontTableStrings = []
|
||||||
fontTable = getFontMap()
|
fontSmallTableStrings = []
|
||||||
|
fontTable = fontTables.getFontMap()
|
||||||
|
fontSmallTable = fontTables.getSmallFontMap()
|
||||||
for sym in textList:
|
for sym in textList:
|
||||||
if sym not in fontTable:
|
if sym not in fontTable:
|
||||||
print('Missing font element for {}'.format(sym))
|
print('Missing Large font element for {}'.format(sym))
|
||||||
exit(1)
|
exit(1)
|
||||||
fontLine = fontTable[sym]
|
fontLine = fontTable[sym]
|
||||||
fontTableStrings.append(fontLine)
|
fontTableStrings.append(fontLine)
|
||||||
outputTable = "const uint8_t userFont_12[] = {" + to_unicode("\n")
|
if sym not in fontSmallTable:
|
||||||
|
print('Missing Small font element for {}'.format(sym))
|
||||||
|
exit(1)
|
||||||
|
fontLine = fontSmallTable[sym]
|
||||||
|
fontSmallTableStrings.append(fontLine)
|
||||||
|
outputTable = "const uint8_t USER_FONT_12[] = {" + to_unicode("\n")
|
||||||
for line in fontTableStrings:
|
for line in fontTableStrings:
|
||||||
# join font table int one large string
|
# join font table int one large string
|
||||||
outputTable = outputTable + line + to_unicode("\n")
|
outputTable = outputTable + line + to_unicode("\n")
|
||||||
outputTable = outputTable + "};" + to_unicode("\n")
|
outputTable = outputTable + "};" + to_unicode("\n")
|
||||||
|
outputTable = outputTable + "const uint8_t USER_FONT_6x8[] = {" + to_unicode(
|
||||||
|
"\n")
|
||||||
|
for line in fontSmallTableStrings:
|
||||||
|
# join font table int one large string
|
||||||
|
outputTable = outputTable + line + to_unicode("\n")
|
||||||
|
outputTable = outputTable + "};" + to_unicode("\n")
|
||||||
return (outputTable, symbolMap)
|
return (outputTable, symbolMap)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user