Commit f941bfa
Add ParagraphStyle setting to choose whether missing font weight/slant should be faked
### Motivation
`OneLineShaper` currently compares each typeface to the requested `FontStyle` and detects cases where there is a mismatch in terms of italic/upright-ness or bold-ness (with a threshold of semibold or heavier counting as 'bold'). If it detects a mismatch it will apply a shear transform to create a fake italic or outdent the strokes to create a fake bold.
While there are cases where this automated behavior is desirable, there are also times where it is preferable to use an unmodified typeface (albeit with a different style than requested) rather than a synthetically generated one.
### Changes
This PR adds a boolean property to `ParagraphStyle` called `fFakeMissingFontStyles` which defaults to `true` (so as not to change the current default behavior) but can be toggled to `false` by calling the `setFakeMissingFontStyles()` accessor. `OneLineShaper` has been updated to apply its faking routines only if the flag is enabled.
This is an imported pull request from
#207
GitOrigin-RevId: 80bf189
Change-Id: I26db9217eb034150685ff74824bc65ca8144491a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/1044616
Commit-Queue: Julia Lavrova <[email protected]>
Reviewed-by: Julia Lavrova <[email protected]>1 parent 6a70548 commit f941bfa
File tree
3 files changed
+21
-12
lines changed- modules/skparagraph
- include
- src
3 files changed
+21
-12
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
84 | 84 | | |
85 | 85 | | |
86 | 86 | | |
87 | | - | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
88 | 90 | | |
89 | 91 | | |
90 | 92 | | |
| |||
121 | 123 | | |
122 | 124 | | |
123 | 125 | | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
124 | 129 | | |
125 | 130 | | |
126 | 131 | | |
| |||
139 | 144 | | |
140 | 145 | | |
141 | 146 | | |
| 147 | + | |
142 | 148 | | |
143 | 149 | | |
144 | 150 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
657 | 657 | | |
658 | 658 | | |
659 | 659 | | |
660 | | - | |
661 | | - | |
662 | | - | |
663 | | - | |
664 | | - | |
665 | | - | |
666 | | - | |
667 | | - | |
668 | | - | |
669 | | - | |
670 | | - | |
| 660 | + | |
| 661 | + | |
| 662 | + | |
| 663 | + | |
| 664 | + | |
| 665 | + | |
| 666 | + | |
| 667 | + | |
| 668 | + | |
| 669 | + | |
| 670 | + | |
| 671 | + | |
| 672 | + | |
671 | 673 | | |
672 | 674 | | |
673 | 675 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
| 30 | + | |
30 | 31 | | |
31 | 32 | | |
32 | 33 | | |
| |||
0 commit comments