Commit graph

183 commits

Author SHA1 Message Date
Emil Ernerfeldt
1363ac4a24 demo: in font book, ask font what characters are supported
This replaces manual lists with a call to ab_glypgh::Font::codepoint_ids
plus names from the unicode_names2 crate.
2021-06-24 17:35:56 +02:00
Benjamin Bouvier
e22c242d17
Use ab_glyph instead of rusttype for font rendering (#490)
* Use ab_glyph instead of rusttype for font rendering

* address review feedback
2021-06-24 12:13:57 +02:00
Emil Ernerfeldt
6e7e88ba80
Use old 1.51 toolchain instead of bleeding edge (#505)
* Use old 1.51 toolchain instead of bleeding edge

1.52 and 1.53 has problems with incremental compilation,
so some people chose to stay on 1.51 for now.

So let's make sure egui supports 1.51 for a while!

* Update to cint 0.2.2 to get rust 1.51.0 compatability
2021-06-23 09:16:39 +02:00
Emil Ernerfeldt
269a4538d9 clippy fixes for rust 1.53 2021-06-22 23:38:34 +02:00
Emil Ernerfeldt
778bcc1ef7
Style tweaks (#450)
* Tweak style

More compact, less round, less noisy

* Button text is now same size as body text
* The rounder corners are now less rounded
* Collapsing headers no longer have a frame around them
* Combo-boxes looks better when opened
* Slightly more muted colors
* Remove extra line spacing after `\n` (i.e. between paragraphs)

* Thinner scrollbars

* Tweak light mode

* Tweak shadows

* Fix broken doc link

* Add style tweak to CHANGELOG
2021-06-12 15:53:56 +02:00
Emil Ernerfeldt
e6fe6a6f6a Fix occasional jittery vertical positioning of glyphs 2021-05-28 19:51:10 +02:00
Violeta Hernández
66095b69a7
Disable default features of ord-float (#440)
* Might fix #439

* `cargo update`

If the page builds, then this did fix it.
2021-05-27 20:25:30 +02:00
Emil Ernerfeldt
3b807e1ad6 Add Context::set_debug_on_hover and egui::trace!(ui) 2021-05-27 19:30:08 +02:00
St John Giddy
e320ef6c64
Detect single-threaded mutex reentry in debug mode (#433)
* fix(plot): expose VLine and HLine

* feat(mutex): detect mutex lock reetry

* chore(mutex): fix lints in tests
2021-05-26 22:13:24 +02:00
Emil Ernerfeldt
196ddff499 Rename Shape::polygon to Shape::convex_polygon
epaint only supports filling convex polygons (for now)
2021-05-20 22:14:08 +02:00
Emil Ernerfeldt
085233f907 Improve various documentation 2021-05-20 22:12:17 +02:00
Gray Olson
c0929014bf
Add support for cint (conversions to and from color types) (#393)
* implement cint for color types under feature flag

* upgrade to cint 0.2, remove from default features

* upgrade to cint 0.2.1, add a couple more from/into implementations

* changelog entry

* fix typo in changelog

* sort dependency

* fmt
2021-05-20 20:09:52 +02:00
Emil Ernerfeldt
6e5b52e3bc Add features extra_asserts and extra_debug_asserts for more asserts
This replaces all debug_asserts with these opt-in asserts

Related: https://github.com/emilk/egui/issues/395
2021-05-17 22:38:39 +02:00
Emil Ernerfeldt
9c475204da Fix uneven text kerning for non-integral dpi scales
Closes https://github.com/emilk/egui/issues/382
2021-05-12 19:41:45 +02:00
Emil Ernerfeldt
7b0f991b20 Improve docs concerning custom fonts, themes and accessibility
Closes https://github.com/emilk/egui/pull/370
Closes https://github.com/emilk/egui/issues/372
2021-05-11 14:56:27 +02:00
Emil Ernerfeldt
8f8ba16696 Release 0.12.0 - Multitouch, user memory, window pivots, and improved plots 2021-05-10 18:27:39 +02:00
Emil Ernerfeldt
b1559963bf Enable a bunch more clippy lints 2021-05-09 14:13:09 +02:00
Emil Ernerfeldt
4022b84ae7 group rustdoc lints under rustdoc:: prefix 2021-05-09 14:01:57 +02:00
Emil Ernerfeldt
fb5176c133 #![allow(clippy::float_cmp)] everywhere
it has always been an annoyance, never a help
2021-05-09 14:00:53 +02:00
Luis Wirth
87bc26fb5a
implement mint conversions (#352)
* Implement mint conversions

Implement conversions for [mint](https://docs.rs/mint) (math interoperability standard types).

- `impl {From, Into}<mint::Point2> for Pos2`
- `impl {From, Into}<mint::Vector2> for Vec2`

* Forward `mint` feature: egui -> epaint -> emath
2021-05-08 08:17:01 +02:00
Emil Ernerfeldt
66122e4c9a Decrease indentation with shift-tab 2021-05-02 20:09:11 +02:00
Emil Ernerfeldt
bf8ce774cc Don't draw bidi control characters
Closes https://github.com/emilk/egui/issues/336
2021-05-02 19:50:06 +02:00
Emil Ernerfeldt
7da9928548 Clean up new code editor code 2021-05-02 19:28:02 +02:00
Cristian Dinu
35c7b09285
Tab identation for multiline text edit (#246)
Lock focus on multiline text edit, and insert tabs on tab char

Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
2021-05-02 18:56:28 +02:00
David Pedersen
02a62d1986
Replace impl Into<String> with impl ToString (#302)
* Replace `impl Into<String>` with `impl ToString`

This is something I ran into today. Types that implement
`std::fmt::Display` cannot be passed to functions that take `impl
Into<String>`. You have to call `display_thing.to_string()`. Its a small
thing but would be fixed by instead taking `impl ToString`.

Afaik `impl ToString` is a superset of `impl Into<String>`, unless users
manually implement `Into<String> for T` (or `From<T> for String`) for
their own types. However I think its more common to implement `Display`
as that works with `println` and friends. The main difference is that
`Display::fmt` can return errors but thats also quite rare in my
experience.

I did some testing in a [playground] and seems to work.

[playground]: https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=1111e071f6ae416ae2688d58d2e9b575

* Silence warnings
2021-04-29 19:49:49 +02:00
Emil Ernerfeldt
58ebb217dc Tesselator: ignore zero-sized clip rects
Improves https://github.com/emilk/egui/issues/328
2021-04-20 10:05:47 +02:00
Emil Ernerfeldt
0f1df90d90 Tesselator: ignore non-positive clip rectangles
Closes https://github.com/emilk/egui/issues/328
2021-04-19 23:00:30 +02:00
Emil Ernerfeldt
76d5229821
CI: run cargo doc (#309)
* Deny doc errors

* Add intentional bad intradoc link to test CI

* Add cargo doc to CI

* Fix carg doc web (add wasm32 target)

* Fix intentionally broken doc-link
2021-04-15 10:35:15 +02:00
Emil Ernerfeldt
d544c3dd8b Release 0.11.0 - Optimization, screen reader & new layout logic 2021-04-05 14:49:06 +02:00
Emil Ernerfeldt
d848b2a664 Add TextEdit::password to hide input characters 2021-04-02 09:58:55 +02:00
Emil Ernerfeldt
fe0d31204e Small optimization of tesselate_text 2021-04-01 23:07:15 +02:00
Emil Ernerfeldt
d7f9e2246c Add a bunch on inline annotations 2021-04-01 23:07:15 +02:00
Emil Ernerfeldt
0a21b01c31 Fix nightly build: remove deprecated missing_crate_level_docs lint
Closes https://github.com/emilk/egui/issues/250 and
https://github.com/emilk/egui/pull/251
2021-03-31 20:00:22 +02:00
Emil Ernerfeldt
4808da44a2 Optimize: more inlining and more use of AHashMap
No real gains, but it didn't hurt either
2021-03-31 17:06:12 +02:00
Emil Ernerfeldt
17983e1bbc Optimize tessellator by around 9% 2021-03-30 22:36:45 +02:00
Emil Ernerfeldt
8c4bb0d1d9 refactor: no need to pass Fonts structure to tessellator
This makes the tesselator take only data as argument,
which is a lot nicer.
2021-03-30 21:41:39 +02:00
Emil Ernerfeldt
0802a9d9c0 Optimize: get glyph uv rects during layouts instead of in tesselation
This allows them to be cached, saving around 20% total CPU.

It also makes the code more nicely structured
2021-03-30 21:07:19 +02:00
Emil Ernerfeldt
1c60dc8d66 Pass around Arc<Galley> to avoid copying a lot of data 2021-03-29 22:49:54 +02:00
Emil Ernerfeldt
94baf98eab Add a galley cache to Fonts to avoid doing the same layout each frame 2021-03-29 22:49:48 +02:00
Emil Ernerfeldt
d4e5133da2 refactor fonts: put TextStyle in Galley instead of in Shape::Text 2021-03-29 21:24:09 +02:00
Emil Ernerfeldt
ade41403b5 refactor fonts: do all text layout via the Fonts struct 2021-03-29 21:12:11 +02:00
Emil Ernerfeldt
46425f1e38 Optimize: add #[inline(always)] to various low-level things
saves up to 20% (text tesselation), and at least 5% overall
2021-03-28 23:16:19 +02:00
Emil Ernerfeldt
cbe6faa83b Render tab character (\t) as four spaces 2021-03-23 20:06:52 +01:00
Emil Ernerfeldt
fd3444473f Add some clippy lints 2021-03-23 19:53:31 +01:00
Emil Ernerfeldt
f5c372910c Replace emath::clamp with f32::clamp (new in rustc 1.50) 2021-03-21 17:47:03 +01:00
Emil Ernerfeldt
e20e3baa98 Bug-fixes related to recent layout rewrite 2021-03-21 14:48:12 +01:00
Emil Ernerfeldt
ec9f374d8c Fix: centered horizontal layouts should never overflow upwards 2021-03-21 10:31:18 +01:00
Emil Ernerfeldt
36d9f8a7c7 Add sanity check on pixels_per_point range 2021-03-17 08:44:00 +01:00
Emil Ernerfeldt
30885b85f9 Derive PartialEq for Vertex, Mesh, Row, Galley and Shape 2021-03-13 12:58:17 +01:00
Emil Ernerfeldt
4c45ca113e Make sure to include license files in the next release 2021-03-09 18:35:13 +01:00
Emil Ernerfeldt
fb2db4940e Release 0.10.0 - Plot and polish 2021-02-28 20:11:37 +01:00
Emil Ernerfeldt
a19140ec67 A simple 2D plot library 2021-02-17 22:54:10 +01:00
Emil Ernerfeldt
fc0bec44ba Remove Fonts::default() implementation 2021-02-08 23:05:48 +01:00
Emil Ernerfeldt
1c415bd8fe Add benchmark for text layout and tesselation 2021-02-08 22:53:31 +01:00
Emil Ernerfeldt
b61db038f2 Release 0.9.0 - light mode, right clicks and more 2021-02-07 17:06:51 +01:00
Emil Ernerfeldt
d9472035d7 Update ahash 0.6.3 -> 0.7.0 2021-02-07 17:04:03 +01:00
Emil Ernerfeldt
bca722ddf8 Add ui.set_enabled(false) to disable all widgets in a Ui
Closes https://github.com/emilk/egui/issues/50
2021-02-07 10:55:45 +01:00
Emil Ernerfeldt
d07a17ac6a Expose more color-related functions and types 2021-02-07 10:36:51 +01:00
Emil Ernerfeldt
8189a78284 Improve text wrapping related to first line indentation and logograms 2021-02-06 15:19:04 +01:00
Emil Ernerfeldt
91ce18d62f Widgets will now always line break at \n characters 2021-02-06 14:50:03 +01:00
Emil Ernerfeldt
2d9d06dbff [emath] Use const values for Vec2::ZERO, Rect::EVERYTHING etc 2021-02-05 10:11:39 +01:00
Emil Ernerfeldt
0942a2aa3b [epaint] Tessellator: handle sharp path corners better
Switch to bevel joints instead of miter joints for > 90° corners
2021-02-04 18:46:36 +01:00
Emil Ernerfeldt
a19fd7b780 Add light mode 2021-02-03 19:30:58 +01:00
Emil Ernerfeldt
7336df53b7 Tweak line spacing for new paragraphs 2021-01-31 16:42:54 +01:00
Emil Ernerfeldt
b647592a5a Wrap text at dashes, punctuations or anywhere if necessary
Closes https://github.com/emilk/egui/issues/55

Supersedes https://github.com/emilk/egui/pull/104
2021-01-31 15:57:19 +01:00
Emil Ernerfeldt
c50190a7e8 Add fake italics (tilt text) 2021-01-30 15:55:40 +01:00
Emil Ernerfeldt
96fb0771a2 Fix text layout bug: empty text would lack first row indentation 2021-01-27 20:17:16 +01:00
Emil Ernerfeldt
2a10747843 Mesh::split_to_u16 now returns a 16-bit indexed Mesh16 2021-01-25 22:06:06 +01:00
Emil Ernerfeldt
b493bc6efc Wrap tesselated output in struct ClippedMesh(Rect, Mesh) 2021-01-25 21:43:17 +01:00
Emil Ernerfeldt
75fa77e040 Rename Triangles to Mesh 2021-01-25 21:23:24 +01:00
Paul Shen
18b9214575
Prefer overlapping row in galley cursor_from_pos (#127) 2021-01-24 15:05:59 +01:00
Emil Ernerfeldt
e2217ff63a [style] Fade out windows on close 2021-01-20 00:31:43 +01:00
Emil Ernerfeldt
37a3fe7f76 Release 0.8.0 - Grid layout & new visual style 2021-01-17 15:28:52 +01:00
Emil Ernerfeldt
31b7eda51e Rename Egui to egui
Also update iamges in README.md
2021-01-17 14:48:59 +01:00
Emil Ernerfeldt
1f2aebc25a Improve documentation 2021-01-17 12:24:13 +01:00
Emil Ernerfeldt
2854a84728 Improve documentation about how to write a painter for egui 2021-01-17 02:12:29 +01:00
Emil Ernerfeldt
8598c365a1 [epaint] Replace tuple (Rect, Shape) with tuple-struct ClippedShape 2021-01-17 01:40:14 +01:00
Emil Ernerfeldt
01bee768d9 Add must_use to Shape 2021-01-16 18:49:10 +01:00
Emil Ernerfeldt
6f814b9516 [demo] Add collapsing header to widget gallery 2021-01-15 18:30:09 +01:00
Emil Ernerfeldt
73d16eb771 Use Grid to add labels to the color picker sliders
Also improve the color preview in the color picker
2021-01-13 23:09:23 +01:00
Emil Ernerfeldt
b10dcf5012 [style] Tweak vertical text alignment 2021-01-13 22:08:35 +01:00
n2
449192e5fb
Text wrap correctly on Chinese chraracter (#104)
* Text wrap correctly on Chinese chrarcter

* Text wrap correctly on Chinese chraracter, checked by a stand-alone function
2021-01-12 10:15:51 +01:00
Emil Ernerfeldt
26d576f510 Break out mod paint into new crate epaint 2021-01-10 15:42:46 +01:00