Commit Graph

55 Commits

Author SHA1 Message Date
Hajime Hoshi
800835d081 Revert "text/v2: rename Glyph -> Cluster"
This reverts commit f0d23de3d3.

Reason: Cluster doesn't represent a cluster but a part of a cluster.
2023-12-05 19:44:32 +09:00
Hajime Hoshi
f0d23de3d3 text/v2: rename Glyph -> Cluster
This also changes AppendClusters to return cluster info even if a
cluster doesn't have a glyph.
2023-12-05 18:00:30 +09:00
Hajime Hoshi
800101da90 text/v2: fix an error message
Updates #2845
2023-12-04 01:17:46 +09:00
Hajime Hoshi
81e0e61a43 text/v2: let NewMultiFace return an error
Updates #2845
2023-12-04 01:16:47 +09:00
Hajime Hoshi
fa3ec12731 text/v2: bug fix: the given slice to MultiFace should be copied
Updates #2845
2023-12-02 22:59:14 +09:00
Hajime Hoshi
dfa058a961 text/v2: change the signature of NewMultiFace
Updates #2845
2023-12-02 22:51:37 +09:00
Hajime Hoshi
5790597a15 text/v2: add LimitedFace
Closes #2857
2023-12-02 16:01:28 +09:00
Hajime Hoshi
a6b4a7a2ac text/v2: add NewMultiFace
Updates #2857
2023-12-02 14:56:03 +09:00
Hajime Hoshi
a444f2dd40 text/v2: replace Metrics.Height/Width with HLineGap and VLineGap
Updates #2454
2023-12-02 14:33:41 +09:00
Hajime Hoshi
2bad1b928f text/v2: remove Metadata.Monospace
Apparently calculating to detection whether a face is monospace or not
is pretty heavy as this might iterate all the glyphs.
2023-11-28 12:22:09 +09:00
Hajime Hoshi
8777d2c529 text/v2: allow io.Reader for NewGoTextFaceSource
This enables to pass fs.File to NewGoTextFaceSource.

Updates #2454
2023-11-26 17:21:47 +09:00
Hajime Hoshi
8291a98756 text/v2: update comments 2023-11-26 15:52:40 +09:00
Hajime Hoshi
b0c5a49f96 text/v2: bug fix: metadata was lacked 2023-11-26 14:23:52 +09:00
Hajime Hoshi
b925f28104 text/v2: add MultiFace
Closes #2845
2023-11-26 03:32:22 +09:00
Hajime Hoshi
415b9c382f text/v2: refactoring 2023-11-25 22:59:01 +09:00
Hajime Hoshi
f34f93a117 text/v2: remove the common UnsafeInternal and add ones to GoTextFaceSource and StdFace
Updates #2454
2023-11-25 22:56:22 +09:00
Hajime Hoshi
989d749475 text/v2: add (*GoTextFaceSource).Metadata
Updates #2454
2023-11-25 22:32:24 +09:00
Hajime Hoshi
20c216b2b1 text/v2: bug fix: glyph image sizes might not be enough
Hajime found that one glyph 'ら' was not rendered correctly in a
vertical Japanese text in examples/texti18n. This was due to an
incorrect calculation of the image sizes.

This change fixes this issue by always adding +1 to the sizes no matter
what the glyph size is or the position is. It is in theory possible to
determine whether this addition is necessary, but this is pretty
complicated and might cause other issues.
2023-11-25 01:26:52 +09:00
Hajime Hoshi
b9b365a576 text/v2: bug fix: Measure didn't work correctly with vertical faces
This also updates examples/texti18n to use text.Measure.

Updates #2143
Updates #2454
2023-11-23 23:25:10 +09:00
Hajime Hoshi
2432888b9f text/v2: fix test 2023-11-21 14:32:30 +09:00
Hajime Hoshi
36fc5b0266 test/v2: add a test for an unhashable font.Face
Updates #2454
Closes #2669
2023-11-20 23:18:59 +09:00
Hajime Hoshi
c0e41de921 text/v2: add AppendVectorPath
Closes #1937
Updates #2454
2023-11-20 03:38:26 +09:00
Hajime Hoshi
03a8aaee5c text/v2: define different key types for StdFace and GoTextFaceSource 2023-11-19 23:40:47 +09:00
Hajime Hoshi
57ae07eb36 text/v2: let StdFace and GoTextFaceSource have their own glyph caches 2023-11-19 23:32:49 +09:00
Hajime Hoshi
7a08737326 text/v2: add copyCheck to GoTextFaceSource 2023-11-19 23:15:18 +09:00
Hajime Hoshi
d2d86fbddd text/v2: add tests
Updates #2454
2023-11-19 17:43:44 +09:00
Hajime Hoshi
ca8a2896b4 text/v2: performance optimization by using image.RGBA
Apparently, image.RGBA doesn't use the slow path at draw.Draw, which
is called from a rasterizer's Draw.

Updates #2454
2023-11-17 13:14:12 +09:00
Hajime Hoshi
4755da6a08 text/v2: performance optimization by caching glyph bounds
Updates #2454
2023-11-17 13:07:59 +09:00
Hajime Hoshi
147175d400 text/v2: rename LineHeight -> LineSpacingInPixels
Updates #2454
2023-11-17 01:19:05 +09:00
Hajime Hoshi
e7fa9d50de text/v2: refactoring 2023-11-17 00:12:17 +09:00
Hajime Hoshi
68d5fa46e2 text/v2: add variations to glyph cache keys 2023-11-16 13:15:51 +09:00
Hajime Hoshi
c7843a4e2b text/v2: make glyphVariationCount more flexible
Updates #2843
2023-11-16 12:49:34 +09:00
Hajime Hoshi
8352be9369 text/v2: increase the soft limit of the glyph cache if the face is small
Updates #2843
2023-11-16 12:07:15 +09:00
Hajime Hoshi
2e60c67ec9 text/v2: improve rendering quality for small faces
Closes #2843
2023-11-16 12:02:50 +09:00
Hajime Hoshi
b2c45a369a text/v2: remove the suffix 'InPixels'
Now all the units are pixels, the suffix is redundant.

Updates #2454
2023-11-15 21:53:58 +09:00
Hajime Hoshi
a612b3c861 text/v2: reduce members in structs 2023-11-15 14:38:03 +09:00
Hajime Hoshi
586a4b6d6e all: rename sizeInPoints -> sizeInPixels 2023-11-15 14:03:22 +09:00
Hajime Hoshi
f2180a5dc5 text/v2: rename SizeInPoints -> SizeInPixels 2023-11-15 13:14:36 +09:00
Hajime Hoshi
4694b78d54 text/v2: refactoring 2023-11-15 12:34:02 +09:00
Hajime Hoshi
5354ccc44f examples/2048: use text/v2
Also, this changes fixes a bug in (*text/v2.GoTextFace).Metrics.

Updates #2454
2023-11-15 12:28:39 +09:00
Hajime Hoshi
fe35180b78 text/v2: implement GoTextFace
Closes #675
Updates #2143
Updates #2454
2023-11-15 03:40:45 +09:00
Hajime Hoshi
46600b42f9 text/v2: swap the arguments of Advance for consistency 2023-11-15 03:18:23 +09:00
Hajime Hoshi
2b46a77e39 text/v2: replace Rune and IndexInBytes with Start/EndIndexInBytes in Glyph
The relationships between runes and glyphs are n:m in general,
then Rune is not enough. Let Glyph have a range of a string.

Updates #2454
2023-11-14 01:38:45 +09:00
Hajime Hoshi
ea1d9dde4e text/v2: add LayoutOptions
Now AppendGlyphs can treat multiple lines and alignments.
2023-11-13 23:47:37 +09:00
Hajime Hoshi
4a84f3697c text/v2: refactoring: simplify implementation 2023-11-13 13:24:39 +09:00
Hajime Hoshi
29fe3f6d21 text/v2: refactoring: don't consider origin's posotion for the subpixel offset Y 2023-11-13 02:44:09 +09:00
Hajime Hoshi
e4f9d854d2 Revert "text/v2: don't consider subpixels in Y direction in StdFace"
This reverts commit 38a0449b44.

Reason: the rendering result has changed unexpectedly
2023-11-13 02:41:38 +09:00
Hajime Hoshi
38a0449b44 text/v2: don't consider subpixels in Y direction in StdFace 2023-11-13 02:24:49 +09:00
Hajime Hoshi
a645fbb2b0 text/v2: refactoring 2023-11-13 02:16:17 +09:00
Hajime Hoshi
9735687d3e text/v2: refactoring 2023-11-13 01:31:25 +09:00