Closes https://github.com/emilk/egui/issues/2068
Before this PR, the default font, Ubuntu-Light, was ~11% smaller
than it should have been, and the default monospace font, Hack,
was ~14% smaller. This means that setting the font size `12` in egui
would yield smaller text than using that font size in any other app.
Ooops!
The change is that this PR now takes into account the ttf properties
`units_per_em` and `height_unscaled`.
If your egui application has specified you own font sizes or text styles
you will see the text in your application grow
larger, unless you go in and compensate by dividing all font sizes by
~1.21 for Ubuntu-Light/Proportional and ~1.16 for Hack/Monospace,
and with something else if you are using a custom font!
This effects any use of `FontId`, `RichText::size`, etc.
This PR changes the default `Style::text_styles` to compensate,
so the default egui style should look the same before and after this PR.
The Vivante GPU on many STM32MP1 based boards does not support sRGB
as an internal format.
Introduce a check for sRGB support and default to `RGBA8` internal format
if not supported.
Additionally the STM32MP1 needs to be checked for `GL_ARB_vertex_array_object`
Closes#1991
* Bug fix: reset repaint countdown when we pass it
* eframe: debug-print what winit event caused a repaint
* egui-winit: don't repaint when only moving window
* fix docstring
* Add `custom_parser` to `DragValue`
* Add `custom_parser` to `Slider`
* Add `binary_u64`, `octal_u64`, and `hexadecimal_u64` to `DragValue`
* Add `binary_u64`, `octal_u64`, and `hexadecimal_u64` to `Slider`
* Fix formatting and errors in docs
* Update CHANGELOG.md
* Fix CI errors
* Replace manual number parsing with i64::from_str_radix. Add support for signed integers.
* Update CHANGELOG.md
* Change documentation.
* Fix documentation.
* Fix documentation.
* Remove unnecessary links.
* egui_demo_app: remove wgpu and pollster as direct dependencies
* eframe: use same web-sys version as wgpu crate
* Make note that web_sys_unstable_apis is required by the wgpu crate
* Rename the glow web painter in eframe
* Remove trait DummyWebGLConstructor from web_glow_painter.rs
* cargo fmt
* Fix check.sh
* egui_extras: Add Table::vertical_scroll_offset
* Added example for TableBuilder::vertical_scroll_offset
* Format code
* Add link to PR in the changelog
Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
* Allow cursors to be linked
* Link cursors in demo
* Refactor cursor memory to deal with removal of plots
* Refactor PlotItem::on_hover to produce a list of cursors
* Use a separate `LinkedCursorsGroup` type to link cursors.
* Refactor `Cursor`.
* Inline `push_argument_ruler` and `push_value_ruler`.
* Update documentation
* Update doc reference
* eframe: allow hooking into EventLoop building
This enables native applications to add an `event_loop_builder` callback
to the `NativeOptions` struct that lets them modify the Winit
`EventLoopBuilder` before the final `EventLoop` is built and run.
This makes it practical for applications to change platform
specific config options that Egui doesn't need to be directly aware of.
For example the `android-activity` glue crate that supports writing
Android applications in Rust requires that the Winit event loop be
passed a reference to the `AndroidApp` that is given to the
`android_main` entrypoint for the application.
Since the `AndroidApp` itself is abstracted by Winit then there's no
real need for Egui/EFrame to have a dependency on the `android-activity`
crate just for the sake of associating this state with the event loop.
Addresses: #1951
* eframe: defer graphics state initialization until app Resumed
Conceptually the Winit `Resumed` event signifies that the application is
ready to run and render and since
https://github.com/rust-windowing/winit/pull/2331 all platforms now
consistently emit a Resumed event that can be used to initialize
graphics state for an application.
On Android in particular it's important to wait until the application
has Resumed before initializing graphics state since it won't have an
associated SurfaceView while paused.
Without this change then Android applications are likely to just show
a black screen.
This updates the Wgpu+Winit and Glow+Winit integration for eframe but
it's worth noting that the Glow integration is still not able to fully
support suspend and resume on Android due to limitations with Glutin's
API that mean we can't destroy and create a Window without also
destroying the GL context, and therefore (practically) the entire
application.
There is a plan (and progress on) to improve the Glutin API here:
https://github.com/rust-windowing/glutin/pull/1435 and with that change
it should be an incremental change to enable Android suspend/resume
support with Glow later.
In the mean time the Glow changes keep the implementation consistent
with the wgpu integration and it should now at least be possible to
start an Android application - even though it won't be able to suspend
correctly.
Fixes#1951