Skip to content

Commit

Permalink
changelog
Browse files Browse the repository at this point in the history
  • Loading branch information
asturur committed Apr 27, 2020
1 parent c2602f0 commit 2b5e1f3
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ project adheres to [Semantic Versioning](http://semver.org/).
* Fix BMP issues. (#1497)
* Update typings to support jpg and addPage on NodeCanvasRenderingContext2D (#1509)
* Fix assertion failure when using Visual Studio Code debugger to inspect Image prototype (#1534)
* Tweak text baseline positioning to be as close as possible to browser canvas (#1562)

2.6.1
==================
Expand Down
6 changes: 2 additions & 4 deletions src/CanvasRenderingContext2d.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2405,13 +2405,11 @@ inline double getBaselineAdjustment(PangoLayout* layout, short baseline) {
PangoLayout* measureLayout = pango_layout_copy(layout);
pango_layout_set_text(measureLayout, "gjĮ測試ÅÊ", -1);
pango_layout_line_get_extents(pango_layout_get_line(measureLayout, 0), NULL, &logical_rect);

// extract the scale value from the current transform so that we know how many pixels we
// need for our extra canvas in the drawImage operation.

double scale = 1.0 / PANGO_SCALE;
double ascent = scale * pango_layout_get_baseline(measureLayout);
double descent = scale * logical_rect.height - ascent;
// 0.072 is a constant that has been chosen comparing the canvas output
// if some code change, this constant can be changed too to keep results aligned
double correction_factor = scale * logical_rect.height * 0.072;

switch (baseline) {
Expand Down

0 comments on commit 2b5e1f3

Please sign in to comment.