mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-16 08:38:26 +00:00
fix broken font rendering in rust 1.91
Rust 1.91 (or perhaps, more accurately llvm?) changed how link ordering works. Previously, modules would be linked in the order they were referenced (e.g. pub mod b; pub mod a; would result in b being at a lower address than a in the resulting binary). However, apparently, this has changed and now someone in their infinite wisdom decided that modules should be alphabetized before linking. I'm really not sure why the arbitrary ordering of the human alphabet is superior to any other system, and also, if you really wanted things alphabetized, you could just alphabetize them in your reference order. Previously the fonts were laid out in a way that tried to minimize cache thrashing by co-locating certain sets of fonts together. Now they are just sprayed around through the arbitrary and not terribly useful permutation funtion of the english alphabet. Rant off. This changes the specification of the fonts in the code generator to be in alphabetical order, making the screen once again legible.
This commit is contained in:
parent
ba52e75ab7
commit
4477af6058
5 changed files with 115 additions and 103 deletions
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"comment": [
|
||||
"Config for use with main.go. Before making changes here, see config_editor.rb."
|
||||
"Config for use with main.go. Before making changes here, see config_editor.rb. NOTE: the glyph set list MUST be alphabetized since Rust 1.91"
|
||||
],
|
||||
"loadermod": [
|
||||
"../../../loader/src/fonts.rs"
|
||||
|
|
@ -9,6 +9,21 @@
|
|||
"../src/fontmap.rs"
|
||||
],
|
||||
"glyphSets": [
|
||||
{
|
||||
"name": "Bold",
|
||||
"sprites": "src_data/latin_bold.png",
|
||||
"size": 15,
|
||||
"cols": 16,
|
||||
"gutter": 1,
|
||||
"border": 1,
|
||||
"legal": "src_data/chicago_legal.txt",
|
||||
"index": "src_data/latin_index.json",
|
||||
"indexType": "json-grid-coord",
|
||||
"glyphTrim": "proportional",
|
||||
"rustout": "../src/fonts/bold.rs",
|
||||
"loaderout": "../../../loader/src/fonts/bold.rs",
|
||||
"small": true
|
||||
},
|
||||
{
|
||||
"name": "Emoji",
|
||||
"sprites": "src_data/basic_emoji.png",
|
||||
|
|
@ -24,21 +39,6 @@
|
|||
"loaderout": "../../../loader/src/fonts/emoji.rs",
|
||||
"small": true
|
||||
},
|
||||
{
|
||||
"name": "zh",
|
||||
"sprites": "src_data/hanzi.png",
|
||||
"size": 16,
|
||||
"cols": 30,
|
||||
"gutter": 2,
|
||||
"border": 2,
|
||||
"legal": "src_data/hanzi_legal.txt",
|
||||
"index": "src_data/hanzi.codepoints",
|
||||
"indexType": "txt-row-major",
|
||||
"glyphTrim": "CJK",
|
||||
"rustout": "../src/fonts/zh.rs",
|
||||
"loaderout": "../../../loader/src/fonts/zh.rs",
|
||||
"small": false
|
||||
},
|
||||
{
|
||||
"name": "ja",
|
||||
"sprites": "src_data/Izumi16.png",
|
||||
|
|
@ -69,21 +69,6 @@
|
|||
"loaderout": "../../../loader/src/fonts/kr.rs",
|
||||
"small": false
|
||||
},
|
||||
{
|
||||
"name": "Bold",
|
||||
"sprites": "src_data/latin_bold.png",
|
||||
"size": 15,
|
||||
"cols": 16,
|
||||
"gutter": 1,
|
||||
"border": 1,
|
||||
"legal": "src_data/chicago_legal.txt",
|
||||
"index": "src_data/latin_index.json",
|
||||
"indexType": "json-grid-coord",
|
||||
"glyphTrim": "proportional",
|
||||
"rustout": "../src/fonts/bold.rs",
|
||||
"loaderout": "../../../loader/src/fonts/bold.rs",
|
||||
"small": true
|
||||
},
|
||||
{
|
||||
"name": "Mono",
|
||||
"sprites": "src_data/latin_mono.png",
|
||||
|
|
@ -114,6 +99,21 @@
|
|||
"loaderout": "../../../loader/src/fonts/regular.rs",
|
||||
"small": true
|
||||
},
|
||||
{
|
||||
"name": "Small",
|
||||
"sprites": "src_data/latin_small.png",
|
||||
"size": 12,
|
||||
"cols": 16,
|
||||
"gutter": 1,
|
||||
"border": 1,
|
||||
"legal": "src_data/geneva_legal.txt",
|
||||
"index": "src_data/latin_index.json",
|
||||
"indexType": "json-grid-coord",
|
||||
"glyphTrim": "proportional",
|
||||
"rustout": "../src/fonts/small.rs",
|
||||
"loaderout": "../../../loader/src/fonts/small.rs",
|
||||
"small": true
|
||||
},
|
||||
{
|
||||
"name": "Tall",
|
||||
"sprites": "src_data/latin_tall.png",
|
||||
|
|
@ -130,19 +130,19 @@
|
|||
"small": true
|
||||
},
|
||||
{
|
||||
"name": "Small",
|
||||
"sprites": "src_data/latin_small.png",
|
||||
"size": 12,
|
||||
"cols": 16,
|
||||
"gutter": 1,
|
||||
"border": 1,
|
||||
"legal": "src_data/geneva_legal.txt",
|
||||
"index": "src_data/latin_index.json",
|
||||
"indexType": "json-grid-coord",
|
||||
"glyphTrim": "proportional",
|
||||
"rustout": "../src/fonts/small.rs",
|
||||
"loaderout": "../../../loader/src/fonts/small.rs",
|
||||
"small": true
|
||||
"name": "zh",
|
||||
"sprites": "src_data/hanzi.png",
|
||||
"size": 16,
|
||||
"cols": 30,
|
||||
"gutter": 2,
|
||||
"border": 2,
|
||||
"legal": "src_data/hanzi_legal.txt",
|
||||
"index": "src_data/hanzi.codepoints",
|
||||
"indexType": "txt-row-major",
|
||||
"glyphTrim": "CJK",
|
||||
"rustout": "../src/fonts/zh.rs",
|
||||
"loaderout": "../../../loader/src/fonts/zh.rs",
|
||||
"small": false
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
@ -20,7 +20,7 @@ latin_index_outfile = "src_data/latin_index.json"
|
|||
|
||||
config = {
|
||||
comment: [
|
||||
"Config for use with main.go. Before making changes here, see config_editor.rb.",
|
||||
"Config for use with main.go. Before making changes here, see config_editor.rb. NOTE: the glyph set list MUST be alphabetized since Rust 1.91",
|
||||
],
|
||||
loadermod: [
|
||||
"../../../../../loader/src/fonts.rs",
|
||||
|
|
@ -29,6 +29,16 @@ config = {
|
|||
"../../fontmap.rs",
|
||||
],
|
||||
glyphSets: [
|
||||
{
|
||||
name: "Bold",
|
||||
sprites: "src_data/latin_bold.png", size: 15, cols: 16, gutter: 1, border: 1,
|
||||
legal: "src_data/chicago_legal.txt",
|
||||
index: latin_index_outfile,
|
||||
indexType: "json-grid-coord",
|
||||
glyphTrim: "proportional",
|
||||
rustout: "../fonts/bold.rs",
|
||||
loaderout: "../../../../../loader/src/fonts/bold.rs",
|
||||
},
|
||||
{
|
||||
name: "Emoji",
|
||||
sprites: "src_data/basic_emoji.png", size: 16, cols: 30, gutter: 2, border: 2,
|
||||
|
|
@ -39,16 +49,6 @@ config = {
|
|||
rustout: "../fonts/emoji.rs",
|
||||
loaderout: "../../../../../loader/src/fonts/emoji.rs",
|
||||
},
|
||||
{
|
||||
name: "zh",
|
||||
sprites: "src_data/hanzi.png", size: 16, cols: 30, gutter: 2, border: 2,
|
||||
legal: "src_data/hanzi_legal.txt",
|
||||
index: "src_data/hanzi.codepoints",
|
||||
indexType: "txt-row-major",
|
||||
glyphTrim: "CJK",
|
||||
rustout: "../fonts/zh.rs",
|
||||
loaderout: "../../../../../loader/src/fonts/zh.rs",
|
||||
},
|
||||
{
|
||||
name: "ja",
|
||||
sprites: "src_data/Izumi16.png", size: 16, cols: 30, gutter: 2, border: 2,
|
||||
|
|
@ -69,16 +69,6 @@ config = {
|
|||
rustout: "../fonts/kr.rs",
|
||||
loaderout: "../../../../../loader/src/fonts/kr.rs",
|
||||
},
|
||||
{
|
||||
name: "Bold",
|
||||
sprites: "src_data/latin_bold.png", size: 15, cols: 16, gutter: 1, border: 1,
|
||||
legal: "src_data/chicago_legal.txt",
|
||||
index: latin_index_outfile,
|
||||
indexType: "json-grid-coord",
|
||||
glyphTrim: "proportional",
|
||||
rustout: "../fonts/bold.rs",
|
||||
loaderout: "../../../../../loader/src/fonts/bold.rs",
|
||||
},
|
||||
{
|
||||
name: "Mono",
|
||||
sprites: "src_data/latin_mono.png", size: 15, cols: 16, gutter: 1, border: 1,
|
||||
|
|
@ -99,6 +89,16 @@ config = {
|
|||
rustout: "../fonts/regular.rs",
|
||||
loaderout: "../../../../../loader/src/fonts/regular.rs",
|
||||
},
|
||||
{
|
||||
name: "Small",
|
||||
sprites: "src_data/latin_small.png", size: 12, cols: 16, gutter: 1, border: 1,
|
||||
legal: "src_data/geneva_legal.txt",
|
||||
index: latin_index_outfile,
|
||||
indexType: "json-grid-coord",
|
||||
glyphTrim: "proportional",
|
||||
rustout: "../fonts/small.rs",
|
||||
loaderout: "../../../../../loader/src/fonts/small.rs",
|
||||
},
|
||||
{
|
||||
name: "Tall",
|
||||
sprites: "src_data/latin_tall.png", size: 19, cols: 30, gutter: 1, border: 1,
|
||||
|
|
@ -110,15 +110,15 @@ config = {
|
|||
loaderout: "../../../../../loader/src/fonts/tall.rs",
|
||||
},
|
||||
{
|
||||
name: "Small",
|
||||
sprites: "src_data/latin_small.png", size: 12, cols: 16, gutter: 1, border: 1,
|
||||
legal: "src_data/geneva_legal.txt",
|
||||
index: latin_index_outfile,
|
||||
indexType: "json-grid-coord",
|
||||
glyphTrim: "proportional",
|
||||
rustout: "../fonts/small.rs",
|
||||
loaderout: "../../../../../loader/src/fonts/small.rs",
|
||||
}
|
||||
name: "zh",
|
||||
sprites: "src_data/hanzi.png", size: 16, cols: 30, gutter: 2, border: 2,
|
||||
legal: "src_data/hanzi_legal.txt",
|
||||
index: "src_data/hanzi.codepoints",
|
||||
indexType: "txt-row-major",
|
||||
glyphTrim: "CJK",
|
||||
rustout: "../fonts/zh.rs",
|
||||
loaderout: "../../../../../loader/src/fonts/zh.rs",
|
||||
},
|
||||
]
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -171,6 +171,10 @@ const loadermodTemplate = `#![cfg_attr(rustfmt, rustfmt_skip)]
|
|||
// DO NOT MAKE EDITS HERE because this file is automatically generated.
|
||||
// The order of these modules affects the link order in the loader, which is referred to in the graphics engine.
|
||||
// To make changes, see <xous_root>/libs/blitstr2/codegen/main.go
|
||||
|
||||
// NOTE: this list must be in alphabetical order since Rust 1.91.0. If it is not alphabetized,
|
||||
// the linker will re-order them into allphabetical order, messing up the offsets.
|
||||
|
||||
{{range $f := .FontDir}}
|
||||
#[cfg(not(feature = "bao1x"))]
|
||||
pub mod {{$f.Name}};{{end}}
|
||||
|
|
@ -184,6 +188,8 @@ const fontmapTemplate = `#![cfg_attr(rustfmt, rustfmt_skip)]
|
|||
#[cfg(not(feature = "bao1x"))]
|
||||
pub const FONT_BASE: usize = 0x2053_0000;
|
||||
|
||||
// NOTE: this list must be in alphabetical order since Rust 1.91.0. If it is not alphabetized,
|
||||
// the linker will re-order them into allphabetical order, messing up the offsets.
|
||||
{{range $f := .FontDir}}#[cfg(not(feature = "bao1x"))]
|
||||
pub const {{$f.Name}}: usize = 0x{{$f.Len}};
|
||||
{{end}}
|
||||
|
|
|
|||
|
|
@ -6,42 +6,44 @@
|
|||
#[cfg(not(feature = "bao1x"))]
|
||||
pub const FONT_BASE: usize = 0x2053_0000;
|
||||
|
||||
// NOTE: this list must be in alphabetical order since Rust 1.91.0. If it is not alphabetized,
|
||||
// the linker will re-order them into allphabetical order, messing up the offsets.
|
||||
#[cfg(not(feature = "bao1x"))]
|
||||
pub const EMOJI_OFFSET: usize = 0x0;
|
||||
#[cfg(not(feature = "bao1x"))]
|
||||
pub const EMOJI_LEN: usize = 0xab00;
|
||||
#[cfg(not(feature = "bao1x"))]
|
||||
pub const ZH_OFFSET: usize = 0xab00;
|
||||
#[cfg(not(feature = "bao1x"))]
|
||||
pub const ZH_LEN: usize = 0x3fea0;
|
||||
#[cfg(not(feature = "bao1x"))]
|
||||
pub const JA_OFFSET: usize = 0x4a9a0;
|
||||
#[cfg(not(feature = "bao1x"))]
|
||||
pub const JA_LEN: usize = 0x56920;
|
||||
#[cfg(not(feature = "bao1x"))]
|
||||
pub const KR_OFFSET: usize = 0xa12c0;
|
||||
#[cfg(not(feature = "bao1x"))]
|
||||
pub const KR_LEN: usize = 0x61600;
|
||||
#[cfg(not(feature = "bao1x"))]
|
||||
pub const BOLD_OFFSET: usize = 0x1028c0;
|
||||
pub const BOLD_OFFSET: usize = 0x0;
|
||||
#[cfg(not(feature = "bao1x"))]
|
||||
pub const BOLD_LEN: usize = 0x19e0;
|
||||
#[cfg(not(feature = "bao1x"))]
|
||||
pub const MONO_OFFSET: usize = 0x1042a0;
|
||||
pub const EMOJI_OFFSET: usize = 0x19e0;
|
||||
#[cfg(not(feature = "bao1x"))]
|
||||
pub const EMOJI_LEN: usize = 0xab00;
|
||||
#[cfg(not(feature = "bao1x"))]
|
||||
pub const JA_OFFSET: usize = 0xc4e0;
|
||||
#[cfg(not(feature = "bao1x"))]
|
||||
pub const JA_LEN: usize = 0x56920;
|
||||
#[cfg(not(feature = "bao1x"))]
|
||||
pub const KR_OFFSET: usize = 0x62e00;
|
||||
#[cfg(not(feature = "bao1x"))]
|
||||
pub const KR_LEN: usize = 0x61600;
|
||||
#[cfg(not(feature = "bao1x"))]
|
||||
pub const MONO_OFFSET: usize = 0xc4400;
|
||||
#[cfg(not(feature = "bao1x"))]
|
||||
pub const MONO_LEN: usize = 0x19e0;
|
||||
#[cfg(not(feature = "bao1x"))]
|
||||
pub const REGULAR_OFFSET: usize = 0x105c80;
|
||||
pub const REGULAR_OFFSET: usize = 0xc5de0;
|
||||
#[cfg(not(feature = "bao1x"))]
|
||||
pub const REGULAR_LEN: usize = 0x19e0;
|
||||
#[cfg(not(feature = "bao1x"))]
|
||||
pub const TALL_OFFSET: usize = 0x107660;
|
||||
#[cfg(not(feature = "bao1x"))]
|
||||
pub const TALL_LEN: usize = 0x6780;
|
||||
#[cfg(not(feature = "bao1x"))]
|
||||
pub const SMALL_OFFSET: usize = 0x10dde0;
|
||||
pub const SMALL_OFFSET: usize = 0xc77c0;
|
||||
#[cfg(not(feature = "bao1x"))]
|
||||
pub const SMALL_LEN: usize = 0x19e0;
|
||||
#[cfg(not(feature = "bao1x"))]
|
||||
pub const TALL_OFFSET: usize = 0xc91a0;
|
||||
#[cfg(not(feature = "bao1x"))]
|
||||
pub const TALL_LEN: usize = 0x6780;
|
||||
#[cfg(not(feature = "bao1x"))]
|
||||
pub const ZH_OFFSET: usize = 0xcf920;
|
||||
#[cfg(not(feature = "bao1x"))]
|
||||
pub const ZH_LEN: usize = 0x3fea0;
|
||||
#[cfg(not(feature = "bao1x"))]
|
||||
pub const FONT_TOTAL_LEN: usize = 0x10f7c0;
|
||||
|
||||
|
|
|
|||
|
|
@ -3,21 +3,25 @@
|
|||
// The order of these modules affects the link order in the loader, which is referred to in the graphics engine.
|
||||
// To make changes, see <xous_root>/libs/blitstr2/codegen/main.go
|
||||
|
||||
// NOTE: this list must be in alphabetical order since Rust 1.91.0. If it is not alphabetized,
|
||||
// the linker will re-order them into allphabetical order, messing up the offsets.
|
||||
|
||||
|
||||
#[cfg(not(feature = "bao1x"))]
|
||||
pub mod bold;
|
||||
#[cfg(not(feature = "bao1x"))]
|
||||
pub mod emoji;
|
||||
#[cfg(not(feature = "bao1x"))]
|
||||
pub mod zh;
|
||||
#[cfg(not(feature = "bao1x"))]
|
||||
pub mod ja;
|
||||
#[cfg(not(feature = "bao1x"))]
|
||||
pub mod kr;
|
||||
#[cfg(not(feature = "bao1x"))]
|
||||
pub mod bold;
|
||||
#[cfg(not(feature = "bao1x"))]
|
||||
pub mod mono;
|
||||
#[cfg(not(feature = "bao1x"))]
|
||||
pub mod regular;
|
||||
#[cfg(not(feature = "bao1x"))]
|
||||
pub mod small;
|
||||
#[cfg(not(feature = "bao1x"))]
|
||||
pub mod tall;
|
||||
#[cfg(not(feature = "bao1x"))]
|
||||
pub mod small;
|
||||
pub mod zh;
|
||||
|
|
|
|||
Loading…
Reference in a new issue