Expose embolden on Font

Change-Id: I92c3b86b8cfff1a77e2a27503ec0cdc8b0cab784
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/406037
Reviewed-by: Mike Reed <reed@google.com>
This commit is contained in:
Mike Reed 2021-05-09 14:02:58 -04:00
parent 7d093d8828
commit 1f85dd9159
5 changed files with 17 additions and 1 deletions

View File

@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [0.26.0] - 2021-04-23
### Added
- Add 'isEmbolden, setEmbolden' to 'Font'
- Add 'drawGlyphs' to 'Canvas'
- Add `drawPatch` to `Canvas`.
- Add `Strut` as a `RectHeightStyle` enum.

View File

@ -1212,6 +1212,7 @@ EMSCRIPTEN_BINDINGS(Skia) {
.function("getScaleX", &SkFont::getScaleX)
.function("getSize", &SkFont::getSize)
.function("getSkewX", &SkFont::getSkewX)
.function("isEmbolden", &SkFont::isEmbolden)
.function("getTypeface", &SkFont::getTypeface, allow_raw_pointers())
.function("setEdging", &SkFont::setEdging)
.function("setEmbeddedBitmaps", &SkFont::setEmbeddedBitmaps)
@ -1220,6 +1221,7 @@ EMSCRIPTEN_BINDINGS(Skia) {
.function("setScaleX", &SkFont::setScaleX)
.function("setSize", &SkFont::setSize)
.function("setSkewX", &SkFont::setSkewX)
.function("setEmbolden", &SkFont::setEmbolden)
.function("setSubpixel", &SkFont::setSubpixel)
.function("setTypeface", &SkFont::setTypeface, allow_raw_pointers());

View File

@ -343,12 +343,14 @@ var CanvasKit = {
getScaleX: function() {},
getSize: function() {},
getSkewX: function() {},
isEmbolden: function() {},
getTypeface: function() {},
setHinting: function() {},
setLinearMetrics: function() {},
setScaleX: function() {},
setSize: function() {},
setSkewX: function() {},
setEmbolden: function() {},
setSubpixel: function() {},
setTypeface: function() {},

View File

@ -473,7 +473,7 @@ function MakeEditor(text, style, cursor, width) {
// f.setTypeface(r.typeface); // r.typeface is always null (for now)
f.setSize(r.size);
// s.bold
f.setEmbolden(s.bold);
f.setSkewX(s.italic ? -0.2 : 0);
p.setColor(s.color ? s.color : [0,0,0,1]);

View File

@ -1675,6 +1675,11 @@ export interface Font extends EmbindObject<Font> {
getSkewX(): number;
/**
* Returns embolden effect for this font. Default value is false.
*/
isEmbolden(): boolean;
/**
* Returns the Typeface set for this font.
*/
getTypeface(): Typeface | null;
@ -1724,6 +1729,12 @@ export interface Font extends EmbindObject<Font> {
*/
setSkewX(sx: number): void;
/**
* Set embolden effect for this font.
* @param embolden
*/
setEmbolden(embolden: boolean): void;
/**
* Requests, but does not require, that glyphs respect sub-pixel positioning.
* @param subpixel