desktop: define default fonts

This commit is contained in:
Tom Schuster 2024-01-08 20:38:59 +01:00 committed by Nathan Adams
parent b34d3c9ad2
commit 4db87a9643
2 changed files with 31 additions and 2 deletions

View File

@ -19,7 +19,7 @@ egui-wgpu = { version = "0.24.1", features = ["winit"] }
image = { version = "0.24", features = ["png"] } image = { version = "0.24", features = ["png"] }
egui-winit = "0.24.1" egui-winit = "0.24.1"
fontdb = "0.16" fontdb = "0.16"
ruffle_core = { path = "../core", features = ["audio", "clap", "mp3", "nellymoser", "default_compatibility_rules", "egui", "default_font"] } ruffle_core = { path = "../core", features = ["audio", "clap", "mp3", "nellymoser", "default_compatibility_rules", "egui"] }
ruffle_render = { path = "../render", features = ["clap"] } ruffle_render = { path = "../render", features = ["clap"] }
ruffle_render_wgpu = { path = "../render/wgpu", features = ["clap"] } ruffle_render_wgpu = { path = "../render/wgpu", features = ["clap"] }
ruffle_video_software = { path = "../video/software", optional = true } ruffle_video_software = { path = "../video/software", optional = true }

View File

@ -11,7 +11,8 @@ use anyhow::anyhow;
use ruffle_core::backend::navigator::{OpenURLMode, SocketMode}; use ruffle_core::backend::navigator::{OpenURLMode, SocketMode};
use ruffle_core::config::Letterbox; use ruffle_core::config::Letterbox;
use ruffle_core::{ use ruffle_core::{
LoadBehavior, Player, PlayerBuilder, PlayerEvent, PlayerRuntime, StageAlign, StageScaleMode, DefaultFont, LoadBehavior, Player, PlayerBuilder, PlayerEvent, PlayerRuntime, StageAlign,
StageScaleMode,
}; };
use ruffle_render::backend::RenderBackend; use ruffle_render::backend::RenderBackend;
use ruffle_render::quality::StageQuality; use ruffle_render::quality::StageQuality;
@ -195,6 +196,34 @@ impl ActivePlayer {
opt.parameters.to_owned(), opt.parameters.to_owned(),
Box::new(on_metadata), Box::new(on_metadata),
); );
player_lock.set_default_font(
DefaultFont::Serif,
vec![
"Times New Roman".into(),
"Tinos".into(),
"Liberation Serif".into(),
"DejaVu Serif".into(),
],
);
player_lock.set_default_font(
DefaultFont::Sans,
vec![
"Arial".into(),
"Arimo".into(),
"Liberation Sans".into(),
"DejaVu Sans".into(),
],
);
player_lock.set_default_font(
DefaultFont::Typewriter,
vec![
"Courier New".into(),
"Cousine".into(),
"Liberation Mono".into(),
"DejaVu Sans Mono".into(),
],
);
} }
Self { player, executor } Self { player, executor }