OLD | NEW |
1 Tips & FAQ | 1 Tips & FAQ |
2 ========== | 2 ========== |
3 | 3 |
4 + [Gyp Options](#gypdefines) | 4 + [Gyp Options](#gypdefines) |
5 + [Bitmap Subsetting](#bitmap-subsetting) | 5 + [Bitmap Subsetting](#bitmap-subsetting) |
6 + [Capture a `.skp` file on a web page in Chromium](#skp-capture) | 6 + [Capture a `.skp` file on a web page in Chromium](#skp-capture) |
7 + [How to add hardware acceleration in Skia](#hw-acceleration) | 7 + [How to add hardware acceleration in Skia](#hw-acceleration) |
8 + [Does Skia support Font hinting?](#font-hinting) | 8 + [Does Skia support Font hinting?](#font-hinting) |
9 + [Does Skia shape text (kerning)?](#kerning) | 9 + [Does Skia shape text (kerning)?](#kerning) |
10 + [How do I add drop shadow on text?](#text-shadow) | 10 + [How do I add drop shadow on text?](#text-shadow) |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 <span id="kerning"></span> | 160 <span id="kerning"></span> |
161 | 161 |
162 Does Skia shape text (kerning)? | 162 Does Skia shape text (kerning)? |
163 ------------------------------- | 163 ------------------------------- |
164 | 164 |
165 No. Skia provides interfaces to draw glyphs, but does not implement a | 165 No. Skia provides interfaces to draw glyphs, but does not implement a |
166 text shaper. Skia's client's often use | 166 text shaper. Skia's client's often use |
167 [HarfBuzz](http://www.freedesktop.org/wiki/Software/HarfBuzz/) to | 167 [HarfBuzz](http://www.freedesktop.org/wiki/Software/HarfBuzz/) to |
168 generate the glyphs and their positions, including kerning. | 168 generate the glyphs and their positions, including kerning. |
169 | 169 |
| 170 [Here is an example of how to use Skia and HarfBuzz |
| 171 together](https://github.com/aam/skiaex). In the example, a |
| 172 `SkTypeface` and a `hb_face_t` are created using the same `mmap()`ed |
| 173 `.ttf` font file. The HarfBuzz face is used to shape unicode text into |
| 174 a sequence of glyphs and positions, and the SkTypeface can then be |
| 175 used to draw those glyphs. |
| 176 |
170 * * * | 177 * * * |
171 | 178 |
172 <span id="text-shadow"></span> | 179 <span id="text-shadow"></span> |
173 | 180 |
174 How do I add drop shadow on text? | 181 How do I add drop shadow on text? |
175 --------------------------------- | 182 --------------------------------- |
176 | 183 |
177 <!--?prettify lang=cc?--> | 184 <!--?prettify lang=cc?--> |
178 | 185 |
179 void draw(SkCanvas* canvas) { | 186 void draw(SkCanvas* canvas) { |
(...skipping 13 matching lines...) Expand all Loading... |
193 blur.setAlpha(blurAlpha); | 200 blur.setAlpha(blurAlpha); |
194 blur.setMaskFilter(SkBlurMaskFilter::Make( | 201 blur.setMaskFilter(SkBlurMaskFilter::Make( |
195 kNormal_SkBlurStyle, | 202 kNormal_SkBlurStyle, |
196 SkBlurMaskFilter::ConvertRadiusToSigma(radius), 0)); | 203 SkBlurMaskFilter::ConvertRadiusToSigma(radius), 0)); |
197 canvas->drawText(text, strlen(text), x + xDrop, y + yDrop, blur); | 204 canvas->drawText(text, strlen(text), x + xDrop, y + yDrop, blur); |
198 canvas->drawText(text, strlen(text), x, y, paint); | 205 canvas->drawText(text, strlen(text), x, y, paint); |
199 } | 206 } |
200 | 207 |
201 <a href='https://fiddle.skia.org/c/@text_shadow'><img src='https://fiddle.skia.o
rg/i/@text_shadow_raster.png'></a> | 208 <a href='https://fiddle.skia.org/c/@text_shadow'><img src='https://fiddle.skia.o
rg/i/@text_shadow_raster.png'></a> |
202 | 209 |
| 210 * * * |
| 211 |
203 <div style="margin-bottom:99%"></div> | 212 <div style="margin-bottom:99%"></div> |
OLD | NEW |