Commit graph

192 commits

Author SHA1 Message Date
Alexis Sellier
b036257729
Make FontId functions constant (#1463) 2022-04-10 16:40:42 +02:00
Emil Ernerfeldt
c2ab0404b7
Fix crash in text layout (#1468)
Fix text layout bug added in https://github.com/emilk/egui/pull/1291
2022-04-09 22:43:40 +02:00
Emil Ernerfeldt
cf0338d48f
Rust 1.60.0 + refactor cargo features (#1467)
* Update to rust 1.60.0
* Rename the feature `convert_bytemuck` to `bytemuck`
* Rename the feature `serialize` to `serde`.
* Make use of the "weak dependency" cargo feature
* Set rust-version = "1.60" for all crates
* egui_glow: clipboard, links, persistence & winit are now opt-in features
2022-04-09 13:54:47 +02:00
Emil Ernerfeldt
7cd285ecbc misc clippy fixes from 1.60.0 2022-04-07 17:03:19 +02:00
Zachary Kohnen
dffab1c737
Add Shape::galley_with_color (#1461) 2022-04-06 18:47:46 +02:00
Emil Ernerfeldt
dfd6a91cb0 Fix doclinks 2022-04-03 20:38:51 +02:00
awaken1ng
901b7c7994
[epaint] Add more text wrapping options (#1291) 2022-04-03 20:28:47 +02:00
4JX
6091370962
Add more doc-links in docstrings (#1419) 2022-04-03 18:18:35 +02:00
Emil Ernerfeldt
10f30a0c52
Fix tessellation of Shape::Vec of heterogenous TextureId:s (#1445)
Closes https://github.com/emilk/egui/issues/1443
2022-04-03 18:14:27 +02:00
Emil Ernerfeldt
b7ebe16cfb
Storage and frame refactor (#1418)
The purpose of this is to expose `frame.storage()` and `frame.storage_mut()` so users can save/load app state from the `App::update` function, without having to add another parameter to that function.

Changes:
* Added `Frame::storage()` and `Frame::storage_mut()`
* `App::update` now takes a `&mut Frame` rather than just `&Frame`
* `Frame` is no longer `Clone` or `Sync` (doesn't have to be since https://github.com/emilk/egui/pull/1366)
2022-03-25 21:19:31 +01:00
Emil Ernerfeldt
8272b08742
Improve text contrast in bright mode (#1412)
* Rename AlphaImage to FontImage to discourage any other use for it
* Encode FontImage as f32 and postpone the alpha correction
* Interpret alpha coverage in a new, making dark text darker, improving contrast in bright mode
2022-03-23 16:49:49 +01:00
Emil Ernerfeldt
1387d6e9d6
Refactor TessellationOptions to expose slider for feathering size (#1408)
The epaint tessellator uses "feathering" to accomplish anti-aliasing. This PS allows you to control the feathering size, i.e. how blurry the edges of epaint shapes are.

This changes the interface of Tessellator slightly, and renames some options in TessellationOptions.
2022-03-23 11:41:38 +01:00
Emil Ernerfeldt
ea9393aa9b
glow painter improvements (#1406)
* Add viewport info to PaintCallback
* glow: be more explicit with more state
* glow: Refactor VAO
2022-03-22 23:11:27 +01:00
Emil Ernerfeldt
41b178b6ec
Use atomic_refcell instead of parking_lot for wasm32 targets (#1404)
Closes https://github.com/emilk/egui/issues/1401
2022-03-22 15:34:21 +01:00
Hunter522
0a400a5bcc
Add Image::rotate and Mesh::rotate (#1371)
Co-authored-by: Hunter Morgan <hmorgan@bellflight.com>
2022-03-22 08:44:23 +01:00
Emil Ernerfeldt
15254f8235
Remove the single_threaded/multi_threaded feature flags (#1390)
Always use parking_lot for mutexes, i.e. always be multi-threaded.

Closes #1379
2022-03-21 22:20:37 +01:00
Emil Ernerfeldt
fda8189cba
Move lints list to .carg/config.toml (#1394)
That way they apply to all crates equally.

See https://github.com/EmbarkStudios/rust-ecosystem/issues/22 for why.
2022-03-21 16:54:29 +01:00
Emil Ernerfeldt
fde9c232b3 Improve the introspection paint stats 2022-03-20 23:05:16 +01:00
Emil Ernerfeldt
861e129ace Add Shape::image convenience method 2022-03-20 20:39:48 +01:00
jean-airoldie
734d4c57ad
Expose more epaint tessellator methods (#1384)
* Expose more tessellator method

* Make public the Tessellator methods to tessellate a circle, a
    mesh, a rectangle, a line, a path, a quadratic and cubic
    bezier curve.
* Add doc to tessellate_text.
* Add Mesh::append_ref method.

* Make tessellate_text take a reference

* Fix breaking change in benchmark
2022-03-20 20:38:48 +01:00
jean-airoldie
0d47e57775
Add Tessellator::set_clip_rect (#1369)
This allows the user to set the outer rectangle used for culling,
which is required to be able to implement its own tessellate_shapes.
2022-03-19 13:01:33 +01:00
Emil Ernerfeldt
6aee4997d4
Add Shape::Callback to do custom rendering inside of an egui UI (#1351)
* Add Shape::Callback to do custom rendering inside of an egui UI
* Use Rc<glow::Context> everywhere
* Remove trait WebPainter
* Add glow::Context to epi::App::setup
2022-03-14 13:25:11 +01:00
Emil Ernerfeldt
510cef02ca Run a formatter on all toml files 2022-03-10 14:25:33 +01:00
Emil Ernerfeldt
a05520b9d3 Release 0.17.0 - Improved font selection and image handling 2022-02-22 19:32:30 +01:00
Emil Ernerfeldt
31d324932c
Introduce egui::FullOutput, returned from Context::run (#1292)
* Introduce `egui::FullOutput`, returned from `Context::run`
* Rename `Output` to `PlatformOutput`
2022-02-22 17:13:53 +01:00
Emil Ernerfeldt
c5a9421dbd
Run wasm-bindgen in CI and update parking_lot (#1293)
* Run wasm-bindgen in CI
* Update parking_lot 0.11 -> 0.12
2022-02-22 16:30:42 +01:00
Emil Ernerfeldt
2e1a4cf08a impl std::fmt::Debug for TexturesDelta 2022-02-22 13:21:41 +01:00
Emil Ernerfeldt
76f564428b Implement Serialize/Deserialize for TextShape 2022-02-22 13:20:46 +01:00
Emil Ernerfeldt
a90379ac8d Ignore characters that are wrong in emoji-icon-font.ttf
Closes https://github.com/emilk/egui/issues/1284
2022-02-22 09:47:31 +01:00
Emil Ernerfeldt
2af1dda4c3 Add TexturesDelta::clear 2022-02-21 21:51:21 +01:00
Emil Ernerfeldt
8f887e2ebd Add Shape::visual_bounding_rect() 2022-02-21 21:46:30 +01:00
Emil Ernerfeldt
6d68838821 Clean up changelogs 2022-02-21 16:10:05 +01:00
Emil Ernerfeldt
89d19860b8 Misc code cleanup, docs fixes, etc 2022-02-19 20:58:28 +01:00
Emil Ernerfeldt
e49245fae5 Improve the anti-aliasing of filled paths with sharp corners
This comes at the cost of these corners sometimes becoming badly
extruded instead. The sharper the corner, the bigger the problem.

A proper fix will have to wait for later.

Part of https://github.com/emilk/egui/issues/1226
2022-02-19 20:46:44 +01:00
Emil Ernerfeldt
b8fbbf7d62 Fix anti-aliasing of filled paths with counter-clockwise winding order
Part of https://github.com/emilk/egui/issues/1226
2022-02-19 20:46:44 +01:00
Emil Ernerfeldt
10634fc344 Improve the Bézier demo: drag control points and simplify code
Follow-up to https://github.com/emilk/egui/pull/1178
2022-02-19 20:46:44 +01:00
Emil Ernerfeldt
3a5ec4733f Fix bug when debug-painting clip rectangles 2022-02-19 20:46:40 +01:00
4JX
14e985a894
Expose FontTweak through egui::FontTweak (#1244) 2022-02-13 10:10:39 +01:00
Emil Ernerfeldt
69626296f1
Make v-align and scale of user fonts tweakable (#1241)
* Add ability to "tweak" the scale and y-offsets of individual fonts
* Change default font tweak

This help vertically center large text.
2022-02-12 18:22:42 +01:00
4JX
c9098288f5
Fix a typo: tolerence -> tolerance (#1214) 2022-02-06 16:30:34 +01:00
Emil Ernerfeldt
9ed96155e9 Rename corner_radius to rounding
Also update changelogs and clean up other aspects of
https://github.com/emilk/egui/pull/1206
2022-02-05 18:13:46 +01:00
4JX
7e7b9e1919
Per-corner rounding of rectangles (#1206)
Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
2022-02-05 17:48:55 +01:00
Emil Ernerfeldt
0fa4bb9c64 Clean up all Cargo.toml: put features higher, and document them better 2022-02-05 11:11:15 +01:00
Emil Ernerfeldt
47038c631e Update image 0.23 -> 0.24 2022-02-04 13:31:06 +01:00
Emil Ernerfeldt
c6ac1827f6
Use tracing crate for logging (#1192)
* egui_web: use tracing crate
* egui_glow: use tracing crate
* Log at the debug level
* egui_demo_app: enable tracing to log to stdout
* Use tracing in egui-winit
* Add opt-in tracing support to egui
2022-02-01 12:27:39 +01:00
Xu Desheng
1f03f53dc0
Add Bezier Shapes #1120 (#1178) 2022-01-31 20:26:31 +01:00
Emil Ernerfeldt
b5aaa5fa6f Improve some feature flags 2022-01-31 19:24:56 +01:00
Emil Ernerfeldt
417bb3123a Fonts: only pre-render glyphs for fonts in the current egui styles 2022-01-26 14:42:44 +01:00
Emil Ernerfeldt
7ed0880b8f
Lower default font atlas size (#1160)
In https://github.com/emilk/egui/pull/1154 the default was set to
16k x 512, which is way excessive, as most of it will be blank.

This PR changes it to 8k x 64, which will make egui
use less RAM and VRAM, and load quicker again.

This also decreases the max size from 16k² to 8k².
That should be enough.
2022-01-25 01:04:28 +01:00
Emil Ernerfeldt
fa43d16c41
Choose your own font and size (#1154)
* Refactor text layout: don't need &Fonts in all functions
* Replace indexing in Fonts with member function
* Wrap Fonts in a Mutex
* Remove mutex for Font::glyph_info_cache
* Remove RwLock around Font::characters
* Put FontsImpl and GalleyCache behind the same Mutex
* Round font sizes to whole pixels before deduplicating them
* Make TextStyle !Copy
* Implement user-named TextStyle:s
* round font size earlier
* Cache fonts based on family and size
* Move TextStyle into egui and Style
* Remove body_text_style
* Query graphics about max texture size and use that as font atlas size
* Recreate texture atlas when it is getting full
2022-01-24 14:32:36 +01:00