Skip to content
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

Scaling #23

Open
Resonanz opened this issue Jan 14, 2024 · 5 comments
Open

Scaling #23

Resonanz opened this issue Jan 14, 2024 · 5 comments

Comments

@Resonanz
Copy link

On my PC (2560x1440) the scaling is great. On Macbook Air (retina display) and Ubuntu on Thinkpad (2440x1920?) the fonts and check boxes are all far too small. To fix, todo.rs line 105 needs adjusting:

ctx.set_pixels_per_point(1.25);

Can this be adjusted automatically?

@Stonks3141
Copy link
Member

Can you test whether the issue still occurs when you are just using egui without catppuccin-egui? If so, it's probably an issue with egui in general and you should file a bug report with them.

@Resonanz
Copy link
Author

Thanks.

These are my Ubuntu settings. You can see VSCode to the right side which works nicely at the 150% scaling.

image

This is the demo with scaling set at default 1.25.

image

and scaling 2.0.

image

As you say, this might be an egui issue or perhaps the scaling needs to be determined each time by checking screen resolution.

@Stonks3141
Copy link
Member

Would you mind building your program without catppuccin-egui and checking whether the problem persists? That way we can determine whether the problem is with egui or catppuccin-egui.

@Resonanz
Copy link
Author

The first image shows an almost-default eframe template build. As shown, the scaling factor is 1.0. As an aside, note that the aliasing is a bit jagged around the radio buttons and elsewhere.

Screenshot from 2024-10-24 21-00-54

The next image is the same code minus catppuccin_egui::set_theme(&ctx, catppuccin_egui::MACCHIATO);. Everything seems to be identical apart from the colors and the aliasing.

Screenshot from 2024-10-24 21-05-22

The last image is a fresh download of catppuccin for egui. I updated the following from 0.26 to 0.29 and ran cargo run --release -p todo. The scaling is the same (as shown in each image).

[dev-dependencies]
eframe = "0.29"

Screenshot from 2024-10-24 21-08-01

Hope that helps :-)

@Stonks3141
Copy link
Member

Everything seems to be identical apart from the colors and the aliasing.

The scaling is the same (as shown in each image).

To clarify, are you saying that the scaling is fine on the eframe demo regardless of whether catppuccin-egui is applied or not, but messed up in catppuccin-egui’s todo example?

As for the problem with jagged and clipped borders, this is most likely because catppuccin-egui defines a border color and egui’s default theme does not, so the problem is not apparent with the default theme. To test this, you could run the following code in that eframe demo without catppuccin-egui, and report the bug to egui if the problem persists. If the bug doesn’t get fixed by egui, then catppuccin-egui can add some kind of configuration option to disable borders, but I’d prefer to avoid increasing the API surface if possible.

fn add_border(old: egui::style::WidgetVisuals) -> egui::style::WidgetVisuals {
    egui::style::WidgetVisuals {
        bg_stroke: egui::Stroke {
            color: egui::Color32::from_rgb(255, 0, 0),
            ..old.bg_stroke
        },
        ..old
    }
}
let old = ctx.style().visuals;
ctx.set_visuals(egui::Visuals {
    widgets: egui::style::Widgets {
        noninteractive: add_border(old.widgets.noninteractive),
        inactive: add_border(old.widgets.inactive),
        hovered: add_border(old.widgets.hovered),
        active: add_border(old.widgets.active),
        open: add_border(old.widgets.open),
    },
    ..old
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants