PangoCairo.show_layout_line
use `PangoCairo.show_layout_line` instead of `PangoCairo.show_layout`. It is equivalent. show_layout (doc): "The top-left corner of the PangoLayout will be drawn at the current point of the cairo context." show_layout_line (doc): "The origin of the glyphs (the left edge of the line) will be drawn at the current point of the cairo context." So it is no longer necessary to query `layout.get_baseline()`.
This commit is contained in:
parent
5e43b05740
commit
324c066685
|
|
@ -670,9 +670,9 @@ const TextElement = new Lang.Class({
|
|||
layout.set_font_description(this.font);
|
||||
layout.set_text(this.text, -1);
|
||||
this.textWidth = layout.get_pixel_size()[0];
|
||||
cr.moveTo(this.x, this.y - layout.get_baseline() / Pango.SCALE);
|
||||
cr.moveTo(this.x, this.y);
|
||||
layout.set_text(this.text, -1);
|
||||
PangoCairo.show_layout(cr, layout);
|
||||
PangoCairo.show_layout_line(cr, layout.get_line(0));
|
||||
|
||||
if (params.showTextCursor) {
|
||||
let cursorPosition = this.cursorPosition == -1 ? this.text.length : this.cursorPosition;
|
||||
|
|
|
|||
Loading…
Reference in New Issue