diff --git a/loader/src/generate_fonts.py b/loader/src/generate_fonts.py index aac925080..1023526fb 100755 --- a/loader/src/generate_fonts.py +++ b/loader/src/generate_fonts.py @@ -9,7 +9,7 @@ from collections import OrderedDict """ This script should be run whenever the fonts are updated inside the blitstr dependency. The -thought is that this is a rare event, and therefore it's better to run this on the rare occassions +thought is that this is a rare event, and therefore it's better to run this on the rare occasions that this happens and vendor in the font files as references to their location in the FLASH memory map. @@ -27,39 +27,37 @@ same level as xous-core, but this can be changed with the `-d` command line argu def main(): parser = argparse.ArgumentParser(description="Build the Betrusted SoC") parser.add_argument( - "-d", "--dir", default="../../../blitstr", help="Location of the blitstr source files", type=str + "-d", "--dir", default="../../services/graphics-server/src/blitstr2", help="Location of the blitstr source files", type=str ) args = parser.parse_args() - fontdir = args.dir + '/src/fonts' + fontdir = args.dir + '/fonts' fontdict = OrderedDict([]) # we want a deterministic dict - filter = re.compile('.*DATA.*u32.*[0-9]*.*') - with os.scandir(fontdir) as listOfEntries: - for entry in listOfEntries: - if entry.is_file(): - print("Processing " + entry.name) - modulename = entry.name.split('.')[0] - with open(entry) as infile, open('fonts/' + entry.name, 'w') as outfile: - outfile.write( - "// This file is autogenerated by xous-core/loader/src/generate_fonts.py. Do not edit.\n") - outfile.write("#[allow(dead_code)]\n") - outfile.write("#[link_section=\".fontdata\"]\n") - outfile.write("#[no_mangle]\n") - outfile.write("#[used]\n") + filter = re.compile('.*GLYPHS.*u32.*[0-9]*.*') + for entry in sorted(os.listdir(fontdir)): + print("Processing " + entry) + modulename = entry.split('.')[0] + with open(fontdir + "/" + entry) as infile, open('fonts/' + entry, 'w') as outfile: + outfile.write( + "// This file is autogenerated by xous-core/loader/src/generate_fonts.py. Do not edit.\n") + outfile.write("#[allow(dead_code)]\n") + outfile.write("#[link_section=\".fontdata\"]\n") + outfile.write("#[no_mangle]\n") + outfile.write("#[used]\n") + copy = False + for line in infile: + if line.strip().startswith('pub const GLYPHS'): + copy = True + if copy: + fixup = line.replace('pub const', 'pub static') + matched = filter.match(fixup) + if matched: + arraylen = re.findall('\d+', matched.group().split(';')[1])[0] + fontdict[modulename] = arraylen + fixup = fixup.replace('GLYPHS', 'DATA_' + modulename.upper()) + outfile.write(fixup) + if line.strip() == "];": copy = False - for line in infile: - if line.strip() == "/// Packed glyph pattern data.": - copy = True - if copy: - fixup = line.replace('pub const', 'pub static') - matched = filter.match(fixup) - if matched: - arraylen = re.findall('\d+', matched.group().split(';')[1])[0] - fontdict[modulename] = arraylen - fixup = fixup.replace('DATA', 'DATA_' + modulename.upper()) - outfile.write(fixup) - if line.strip() == "];": - copy = False print(fontdict) with open('fonts.rs', 'w') as modfile: modfile.write("// This file is autogenerated by xous-core/loader/src/generate_fonts.py. Do not edit.\n") diff --git a/services/graphics-server/Cargo.toml b/services/graphics-server/Cargo.toml index 13397f64b..4633d5a57 100644 --- a/services/graphics-server/Cargo.toml +++ b/services/graphics-server/Cargo.toml @@ -34,4 +34,4 @@ debugprint = [] braille = [] gfx-testing = [] ditherpunk = [] -default = ["gfx-testing"] +default = [] diff --git a/services/graphics-server/src/main.rs b/services/graphics-server/src/main.rs index 3623dcc16..2afc83662 100644 --- a/services/graphics-server/src/main.rs +++ b/services/graphics-server/src/main.rs @@ -79,6 +79,7 @@ fn map_fonts() -> MemoryRange { blitstr2::fonts::regular::GLYPH_LOCATION.store((fontregion.as_ptr() as usize + fontmap::REGULAR_OFFSET as usize) as u32, Ordering::SeqCst); blitstr2::fonts::small::GLYPH_LOCATION.store((fontregion.as_ptr() as usize + fontmap::SMALL_OFFSET as usize) as u32, Ordering::SeqCst); blitstr2::fonts::zh::GLYPH_LOCATION.store((fontregion.as_ptr() as usize + fontmap::ZH_OFFSET as usize) as u32, Ordering::SeqCst); + blitstr2::fonts::tall::GLYPH_LOCATION.store((fontregion.as_ptr() as usize + fontmap::TALL_OFFSET as usize) as u32, Ordering::SeqCst); fontregion }