Compare commits

..
5 changed files with 2 additions and 23 deletions

View file

@ -569,15 +569,8 @@ fn open(engine: bool, show: fn(&mut App, &mut Ui), mut args: Vec<String>) -> Exi
app.shell = Some(shell);
}
let mut code = ExitCode::SUCCESS;
let mut opened = 0;
loop {
if window {
if opened > 0 {
// The new window's painter starts empty: fonts and icons go up again.
crate::icons::forget();
crate::fonts::reload(&ctx, opened);
}
opened += 1;
let this = &mut app;
let make: eframe::AppCreator<'_> = Box::new(move |_| Ok(Box::new(Window { app: this, show })));
if let Err(e) = eframe::run_native_ext(APP_ID, options(&paths), Some(ctx.clone()), make) {

View file

@ -10,12 +10,6 @@ const SEMI: &str = "rubik-600";
static RUBIK: &[u8] = include_bytes!("../../../assets/Rubik.ttf");
pub fn install(ctx: &egui::Context) {
reload(ctx, 0);
}
/// A new window has a new painter that holds no font atlas: other definitions (an unused family named after the
/// window count) make egui build and send the whole atlas again.
pub fn reload(ctx: &egui::Context, window: u32) {
let mut defs = FontDefinitions::default();
let fallback = defs.families.get(&FontFamily::Proportional).cloned().unwrap_or_default();
for (key, family, weight) in [
@ -28,9 +22,6 @@ pub fn reload(ctx: &egui::Context, window: u32) {
let names = std::iter::once(key.to_string()).chain(fallback.iter().cloned()).collect();
defs.families.insert(family, names);
}
if window > 0 {
defs.families.insert(FontFamily::Name(format!("window-{window}").into()), vec!["rubik".into()]);
}
ctx.set_fonts(defs);
ctx.all_styles_mut(|s| {
s.text_styles = [

View file

@ -14,11 +14,6 @@ thread_local! {
static CACHE: RefCell<HashMap<(usize, &'static str, u32), TextureHandle>> = RefCell::new(HashMap::new());
}
/// A new window's painter has none of the icon textures: drop them so they are made and sent again.
pub fn forget() {
CACHE.with_borrow_mut(HashMap::clear);
}
/// Premultiplied pixels of an SVG, `px` wide and high.
fn render(svg: &str, px: u32) -> Option<ColorImage> {
let tree = usvg::Tree::from_str(svg, &usvg::Options::default()).ok()?;

View file

@ -24,6 +24,6 @@ pkgbase = medlar-bin
options = !strip
options = !debug
source = Medlar-0.1.1-Linux-x86_64.tar.gz::https://archlinux.tail7c4f5e.ts.net/git/astar76/Medlar/releases/download/v0.1.1/Medlar-0.1.1-Linux-x86_64.tar.gz
sha256sums = 3be0a4ec1b953819d8b84b0563fcacddcee3c93a3c4ba40d364a09c590c7f7a6
sha256sums = c585f3bb2646a9115b6850533afa362b70863e676e0b2e98ceb9ca459e22671b
pkgname = medlar-bin

View file

@ -15,7 +15,7 @@ conflicts=('medlar')
options=('!strip' '!debug')
# MEDLAR_TARBALL points at a local copy (offline build); default is the release download.
source=("Medlar-$pkgver-Linux-x86_64.tar.gz::${MEDLAR_TARBALL:-$url/releases/download/v$pkgver/Medlar-$pkgver-Linux-x86_64.tar.gz}")
sha256sums=('3be0a4ec1b953819d8b84b0563fcacddcee3c93a3c4ba40d364a09c590c7f7a6')
sha256sums=('c585f3bb2646a9115b6850533afa362b70863e676e0b2e98ceb9ca459e22671b')
package() {
cd "$srcdir/medlar-$pkgver"