Commit graph

133 commits

Author SHA1 Message Date
Billy Messenger
b2129f1765
Add support for custom icons/glyphs (#102)
* add support for svg icons

* remove SVG helper struct

* forgot to remove default features

* rework api for custom glyphs

* remove unused file

* expose custom glyph structs

* remove `InlineBox`

* use slice for TextArea::custom_glyphs

* offset custom glyphs by text area position

* remove svg feature

* remove unused file

* add scale field to CustomGlyphInput

* update custom-glyphs example to winit 0.30

* fix the mess merge conflicts made

* add final newline

* make custom-glyphs a default feature

* remove custom-glyphs feature

* remove unnecessary pub(crate)

* rename CustomGlyphDesc to CustomGlyph

* rename CustomGlyphID to CustomGlyphId

* improve custom glyph API and refactor text renderer

* rename CustomGlyphInput and CustomGlyphOutput, add some docs
2024-09-16 22:57:40 -06:00
Josh Groves
ce6ede951c
Move text area bounds outside run/glyph loops (#110) 2024-07-29 11:59:26 -02:30
Josh Groves
3dab1f2dc4
Update CI (#109)
* Update to checkout 4

* Make sure CI includes all targets
2024-07-29 11:14:41 -02:30
tamewild
f82094703e
iterate on visible runs within textbounds (#108) 2024-07-28 09:04:16 -02:30
Billy Messenger
719d69a1ee
update example to use winit 0.30 (#105)
* update example to use winit 0.30

* omit unneeded field in example
2024-07-25 15:35:55 -02:30
Erich Gubler
9def853042
build: upgrade wgpu 0.20 → 22 (#106) 2024-07-24 00:46:06 -02:30
Billy Messenger
47f4126f99
update to cosmic-text 0.12 and rustc-hash 2.0 (#104) 2024-07-08 10:22:33 -02:30
Josh Groves
2a45708767
Use default limits for example (#98) 2024-05-27 00:04:17 -02:30
Pēteris Pakalns
0fdbd90c55
Simplify rendering pipeline, reduce gpu memory usage, remove duplicated data (#86) 2024-05-26 22:52:30 -02:30
Héctor Ramón
b411ea71e7
Introduce explicit Viewport sharing (#96) 2024-05-08 11:47:58 -02:30
Héctor Ramón
5aed9e1477
Support sharing Pipeline state between TextAtlas (#95)
* Support sharing `Pipeline` state between `TextAtlas`

* Keep using `Vec` for pipeline cache

* Use `OnceCell` to keep `Pipeline` private

* Revert "Use `OnceCell` to keep `Pipeline` private"

This reverts commit 4112732b1734a3bb6b915d2103e699ef549b77c1.

* Rename `Pipeline` type to `Cache`
2024-05-08 11:09:19 -02:30
EggShark
670140e2a1
update to wgpu 0.20.0 (#93) 2024-04-29 13:01:15 -02:30
Héctor Ramón
3e281d1828
Use rustc-hash for HashSet of glyphs_in_use (#90) 2024-03-29 22:47:39 -02:30
Héctor Ramón Jiménez
4f24305ac5 Reuse Vec allocations in TextRenderer 2024-03-29 21:24:16 -02:30
Xavier Lambein
c16b6eb957
Bump cosmic text to 0.11 (#89)
Co-authored-by: Xavier Lambein <xavier@lambein.xyz>
2024-03-25 21:56:37 -02:30
Pēteris Pakalns
f95e66f612
Support multi viewport rendering with reusable text atlas (#88) 2024-03-25 21:55:57 -02:30
Jengamon
4700e54f16
Do a little feature magic to allow to build for web (#83)
* Remove default features

* Enable default features for dev (testing) builds

* Enable WGSL unconditionally
2024-02-21 21:19:54 -03:30
grovesNL
4590abae08 Release 0.5.0 2024-01-17 20:33:06 -03:30
TheEggShark
65825aa0d4 update to wgpu 0.19.0 2024-01-17 20:25:33 -03:30
grovesNL
3425efd522 Release 0.4.1 2024-01-15 21:36:08 -03:30
grovesNL
bfb07147cd Don't convert web text colors to linear 2024-01-15 21:32:22 -03:30
grovesNL
7f9afac93e Release 0.4.0 2024-01-15 16:24:45 -03:30
grovesNL
1bb46e41ff Update lru 2024-01-15 16:04:27 -03:30
grovesNL
c2469de817 Update winit 2024-01-15 16:04:27 -03:30
grovesNL
ce394f9d53 Internally convert text colors to linear 2024-01-15 13:05:48 -03:30
grovesNL
ca5f82e5e9 Grow by a factor of 2
This reduces the amount of growing necessary for large glyphs
2024-01-15 11:49:35 -03:30
Lukas Kalbertodt
b15437b87f Fix typo in docs 2024-01-02 20:50:08 -03:30
Lukas Kalbertodt
914a283e3f Add #[doc(no_inline)] to cosmic-text reexports
Before this commit, all reexported symbols were displayed as if they
were part of `glyphon` directly. Users not being able to see at a glance
what's part of which crate has a few disadvantages. It makes
understanding the whole stack more difficult, since it's unclear what's
part of the wgpu-integration and what's part of the general text
handling. Personally, I also think this can deter people from using
glyphon as this makes the crate (which is "just" the wgpu integration)
seem huge. Finally, some symbols in the docs were not linked (as if it
was private), which is also really bad for browsing docs.
2024-01-02 20:50:08 -03:30
TheEggShark
941309aed2 fixed cargo fmt errors 2023-12-19 12:28:19 -03:30
TheEggShark
f13c5f024e added clippy suggestions 2023-12-19 12:28:19 -03:30
julianbraha
f554de853b Update etagere 2023-11-19 22:41:54 -03:30
Héctor Ramón Jiménez
2caa9fc5e5 Update wgpu to 0.18 2023-10-26 22:52:50 -02:30
Duncan Dean
6aaaf5071e Bump cosmic-text to 0.10 2023-10-19 14:37:22 -02:30
Azur冰弦
9e25714a44 Bump winit to 0.28.7 2023-10-12 13:38:25 -02:30
Lixou
1de354c05d Bump wgpu to 0.17.1 2023-10-10 13:33:47 -02:30
Ian Douglas Scott
20f0f8fa80 Update wgpu (and dev-dependecies) 2023-08-14 22:14:06 -02:30
c-u
3c9f7c4eb1
Add Interpolation attribute for the VertexOutput and add Error trait implementation for RenderError (#49)
* impl trait Error for RenderError

* fix shader for usage in web
2023-08-06 13:07:42 -02:30
grovesNL
33c64acbcf Release 0.3.0 2023-07-26 22:42:37 -02:30
grovesNL
8f89ffed13 Bump lru to 0.11 2023-07-26 22:39:13 -02:30
Héctor Ramón Jiménez
81dedbd042 Implement subpixel glyph positioning and scaling
The latest `cosmic-text` release performs bucketing calculations after
layouting. This allows us to provide proper subpixel offsets, as well as
scale any buffer thanks to its linear layout properties.

See https://github.com/pop-os/cosmic-text/pull/143.
2023-07-11 00:18:25 -02:30
Héctor Ramón Jiménez
595e09a497 Take an IntoIterator instead of Iterator in prepare methods 2023-07-10 15:25:47 -02:30
Héctor Ramón Jiménez
1469768013 Iterate over text areas only once in prepare 2023-07-10 15:25:47 -02:30
Héctor Ramón Jiménez
d40b6ad2ed Remove Copy implementation for TextArea 2023-07-10 15:25:47 -02:30
Héctor Ramón Jiménez
0857bef584 Take an Iterator of TextArea in prepare 2023-07-10 15:25:47 -02:30
Héctor Ramón Jiménez
7f31965063 Fix potentially evicting glyphs in use during try_allocate 2023-07-04 14:54:05 -02:30
Héctor Ramón Jiménez
bc9cc82050 Use new etagere release 🎉 2023-07-04 14:54:05 -02:30
Héctor Ramón Jiménez
f64771c2c3 Grow internal packer and re-upload glyphs automatically 2023-07-04 14:54:05 -02:30
Héctor Ramón Jiménez
a74ce29c1a Implement growing logic for TextAtlas
The `TextAtlas` will have an initial size of `256` (we could make this
configurable) and `try_allocate` will keep track of the glyphs in use
in the current frame, returning `None` when the LRU glyph is in use.

In that case, `TextRenderer::prepare` will return
`PrepareError::AtlasFull` with the `ContentType` of the atlas that is
full. The user of the library can then call `TextAtlas::grow` with the
provided `ContentType` to obtain a bigger atlas (by `256`).

A `TextAtlas::grow` call clears the whole atlas and, as a result, all of
the `prepare` calls need to be repeated in a frame until they all
succeed. Overall, the atlas will rarely need to grow and so the calls
will not need to be repated often.

Finally, the user needs to call `TextAtlas::trim` at the end of the
frame. This allows us to clear the glyphs in use collection in the atlas. Maybe
there is a better way to model this in an API that forces the user to
trim the atlas (e.g. make `trim` return a new type and changing `prepare` and `render` to take that type instead).
2023-07-04 14:54:05 -02:30
Gijs Burghoorn
d20643702f Doc: Add small summary of crate goal in doc.rs 2023-06-07 10:07:44 -02:30
Héctor Ramón Jiménez
9f82af4f7d Introduce ColorMode for Atlas 2023-06-06 11:56:02 -02:30