Skip to content

Small font cleanup #892

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 4, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion agb/src/display/font/layout.rs
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,6 @@ impl Iterator for Layout {
}

if let Some(change_colour) = ChangeColour::try_from_char(char) {
crate::println!("Colour change to {change_colour:?}");
self.palette_index = change_colour.palette_index;

if letter_group.range.is_empty() {
Expand Down
28 changes: 28 additions & 0 deletions agb/src/display/font/tiled.rs
Original file line number Diff line number Diff line change
Expand Up @@ -164,4 +164,32 @@ mod test {

assert_image_output("gfx/test_output/bg_font_render_japanese.png");
}

#[test_case]
fn background_text_single_group(_gba: &mut Gba) {
static PALETTE: Palette16 = const {
let mut palette = [0x0; 16];
palette[1] = 0xFF_FF;
Palette16::new(palette)
};

VRAM_MANAGER.set_background_palette(0, &PALETTE);

let mut bg = RegularBackgroundTiles::new(
Priority::P0,
RegularBackgroundSize::Background32x64,
TileFormat::FourBpp,
);

let mut layout = Layout::new(
"現代社会において、情報技術の進化は目覚ましい。それは、私たちの生活様式だけでなく、思考様式にも大きな影響を与えている。例えば、スマートフォンやタブレット端末の普及により、いつでもどこでも情報にアクセスできるようになった。これにより、知識の共有やコミュニケーションが容易になり、新しい文化や価値観が生まれている。しかし、一方で、情報過多やプライバシーの問題など、新たな課題も浮上している。私たちは、これらの課題にどのように向き合い、情報技術をどのように活用していくべきだろうか。それは、私たち一人ひとりが真剣に考えるべき重要なテーマである。",
&FONT,
AlignmentKind::Left,
16,
200,
);
let mut bg_text_render = RegularBackgroundTextRenderer::new((20, 20));

bg_text_render.show(&mut bg, &layout.next().unwrap());
}
}