Commit graph

65 commits

Author SHA1 Message Date
John Nunley
aa1b37aede
Add Align::End for end-based alignment
For use cases that want to reverse the alignment of RTL
lines, this avoids needing to check the RTL status of every line
manually.

This is a breaking change.
2023-07-07 21:31:17 -07:00
Héctor Ramón Jiménez
eb09cf0259
Introduce PhysicalGlyph for offsetting and scaling 2023-06-20 06:07:24 +02:00
Héctor Ramón Jiménez
2fbd65a64f
Compute ascent and descent only once in shape_skip 2023-06-16 02:39:54 +02:00
Héctor Ramón Jiménez
ffa08d2da1
Use rustybuzz in shape_fallback instead of swash 2023-06-16 02:38:00 +02:00
Héctor Ramón Jiménez
c2bef6a345
Align glyphs in a LayoutRun to baseline 2023-06-16 02:15:44 +02:00
Jeremy Soller
9062cce140
Merge pull request #122 from hecrj/feature/shaping-switch
`Shaping` strategy selection
2023-06-08 12:47:04 -06:00
Nico Burns
8d37da51b9 Fix non-wrapped alignment 2023-05-19 02:45:35 +01:00
Héctor Ramón Jiménez
b85d6a4f23
Use Vec::new instead of vec! macro 2023-04-21 20:56:11 +02:00
Héctor Ramón Jiménez
87d75531b7
Allow Shaping::Basic only if swash feature is enabled 2023-04-21 20:47:02 +02:00
Héctor Ramón Jiménez
9e559e150d
Write docs for Shaping enum 2023-04-21 20:27:00 +02:00
Héctor Ramón Jiménez
0f055c0a13
Replace skip_shaping boolean with Shaping enum 2023-04-21 20:24:44 +02:00
Héctor Ramón Jiménez
ad111a1df1
Add skip_shaping flag to avoid expensive shaping when not needed 2023-04-19 00:24:43 +02:00
Jeremy Soller
9ebbc33792 Merge branch 'mut-font-system' of https://github.com/geieredgar/cosmic-text into geieredgar-mut-font-system 2023-03-17 18:15:45 -06:00
Edgar Geier
d297a6a48a
Call get_font lazily 2023-03-14 00:39:50 +01:00
Hojjat
05b069911a Fix indices (suggestions by geieredgar) 2023-03-13 13:08:35 -06:00
Hojjat
7fa51c6404 Fixed some typos 2023-03-13 08:50:24 -06:00
Hojjat
8d503af956 bugfix: mixed ltr+rtl overflow 2023-03-12 21:37:10 -06:00
Edgar Geier
384c5c1fdc
Remove Mutex from FontSystem 2023-03-12 10:39:56 +01:00
Edgar Geier
46e9ef0246
Make BorrowedWithFontSystem borrow FontSystem mutably 2023-03-12 10:39:56 +01:00
Edgar Geier
bff5aaaea3
Make FontSystem not self-referencing 2023-03-12 10:23:54 +01:00
Edgar Geier
2c1d564d62
Update fontdb dependency to version 0.13 2023-03-03 13:07:49 +01:00
Jeremy Soller
eca804c732
Revert "Make FontSystem not self-referencing and update fontdb and rustybuzz" 2023-03-02 18:16:57 -07:00
Edgar Geier
f8bc71af0a
Update fontdb dependency to version 0.13 2023-03-03 00:53:00 +01:00
Edgar Geier
506a4194be
Make FontSystem not self-referencing 2023-03-03 00:53:00 +01:00
Edgar Geier
6c501c6640
Fix clippy warnings 2023-03-01 22:58:41 +01:00
Héctor Ramón Jiménez
4320ae6329
Use f32 instead of i32 for lengths
This allows users to use logical coordinates instead of physical ones.
2023-02-28 03:39:31 +01:00
Hojjat
fdd3ee83a5 Fix selection highlighting when paragraph is justified 2023-02-24 13:00:25 -07:00
Hojjat
d313713f44 Removed alignment from Buffer, added alignment per Bufferline to editor-libcosmic 2023-02-23 14:23:56 -07:00
Hojjat
27d52a12e9 Fix the trailing space 2023-02-23 13:26:21 -07:00
Hojjat
59e89bdbaa Justified 2023-02-22 20:48:57 -07:00
Hojjat
00ff5b72f3 Align Left, Right, and Center works 2023-02-22 18:31:49 -07:00
Jeremy Soller
8cc988d374 Run cargo fmt 2023-01-04 20:03:03 -07:00
Hojjat
b9fef72f76 Added an enum with the option for "No Wraping" 2022-12-20 13:38:34 -07:00
Hojjat
1454a53b21 Glyph based wrapping implemeted 2022-12-20 04:48:53 -07:00
Hojjat
a4ed73b664 Simplify the layout algorithm 2022-12-20 04:48:53 -07:00
Hojjat
1bc476c06e This solves a few bugs:
Fixes long words in BiDi text.
Fixes issues with small text area and large font (no duplicates)
But I feel I need to rewirte this function. It's too convluted and ugly
2022-12-20 04:48:53 -07:00
Hojjat
499e6ccb06 Bug fix: duplicate lines in specific conditions. 2022-12-20 04:48:53 -07:00
Hojjat
8beeca2822 Fix duplicate visual lines when a word is too long
Words longer than the linewidth used to show up duplicated
2022-12-20 04:48:53 -07:00
Hojjat
e38a302599 Make ShapeWord::x/y_advance pub 2022-12-20 04:48:53 -07:00
Hojjat
25a3367ef9 Turn a consequtive whitespaces into separate words
Currently a sequence like this "hello      " (a word followed by
6 spaces). Would be shaped into two words: ["hello     " , " "]
This causes issues, since the first word is only 5 letters long,  not 10
This commit will break this sequence into:
["hello", " ", " ", " ", " ", " ", " "]
This helps with correct line wrappipng
2022-12-20 04:48:53 -07:00
Hojjat
3ef56b7112 Ignore the last space when wrapping. 2022-12-20 04:48:53 -07:00
Hojjat
cb958c63f8 Clean up 2022-12-20 04:48:53 -07:00
Hojjat
089a926615 Bidi reordering works with wrapping. 2022-12-20 04:48:53 -07:00
Héctor Ramón Jiménez
01f6c1fd89 Expose subpixel offsets in LayoutGlyph 2022-12-16 13:50:40 -07:00
Héctor Ramón Jiménez
be4dc2749c Fix line width in LayoutLine for RTL 2022-12-15 11:17:54 -07:00
Héctor Ramón Jiménez
67950724c3 Add line width field to LayoutLine 2022-12-15 11:17:54 -07:00
Jeremy Soller
8bf0032974
Add custom metadata to Attrs, copied to ShapeGlyph and LayoutGlyph 2022-12-14 09:19:03 -07:00
Jeremy Soller
f5968c4c37
Only do glyph wrapping if wrap_simple is enabled 2022-12-13 09:23:35 -07:00
Jeremy Soller
dd94bc634b
Do not wrap empty lines 2022-12-08 11:33:36 -07:00
Jeremy Soller
3d60d55309
Add comment for last change 2022-12-08 10:35:13 -07:00