[smuxi: 14/15] [Frontend-GNOME] Drop the emoji to the bottom of the line
- From: Mirco M. M. Bauer <mmmbauer src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [smuxi: 14/15] [Frontend-GNOME] Drop the emoji to the bottom of the line
- Date: Tue, 3 Feb 2015 01:08:08 +0000 (UTC)
commit 990821889ec41d0750a6a57a6c5660d66c92a38a
Author: Carlos MartÃn Nieto <cmn dwim me>
Date: Mon Feb 2 22:23:19 2015 +0100
[Frontend-GNOME] Drop the emoji to the bottom of the line
We create the pibxuf with the full line height, let's drop the base
to the bottom of the line instead of the baseline so we align the
pixbuf such that we don't make the line any higher.
src/Frontend-GNOME/Views/MessageTextView.cs | 9 +++++++++
1 files changed, 9 insertions(+), 0 deletions(-)
---
diff --git a/src/Frontend-GNOME/Views/MessageTextView.cs b/src/Frontend-GNOME/Views/MessageTextView.cs
index 2d0073e..94e34e7 100644
--- a/src/Frontend-GNOME/Views/MessageTextView.cs
+++ b/src/Frontend-GNOME/Views/MessageTextView.cs
@@ -226,8 +226,10 @@ namespace Smuxi.Frontend.Gnome
var buffer = Buffer;
int width, height;
+ int descent;
using (var layout = CreatePangoLayout(null)) {
layout.GetPixelSize(out width, out height);
+ descent = layout.Context.GetMetrics(layout.FontDescription, null).Descent;
}
_MessageTextTagTable.Foreach((tag) => {
@@ -236,6 +238,7 @@ namespace Smuxi.Frontend.Gnome
}
var emojiTag = tag as EmojiTag;
+ tag.Rise = -descent;
var pix = new Gdk.Pixbuf(emojiTag.Path, -1, height);
var beforeIter = buffer.GetIterAtMark(emojiTag.Mark);
@@ -303,8 +306,12 @@ namespace Smuxi.Frontend.Gnome
}
int width, height;
+ int widthPango, heightPango;
+ int descent;
using (var layout = CreatePangoLayout(null)) {
layout.GetPixelSize(out width, out height);
+ layout.GetSize(out widthPango, out heightPango);
+ descent = layout.Context.GetMetrics(layout.FontDescription, null).Descent;
}
// A mark here serves two pusposes. One is to allow us to apply the
@@ -322,6 +329,7 @@ namespace Smuxi.Frontend.Gnome
buffer.InsertPixbuf(ref iter, pix);
var beforeIter = buffer.GetIterAtMark(mark);
var imgTag = new EmojiTag(mark, emojiFile.FullName);
+ imgTag.Rise = - descent;
_MessageTextTagTable.Add(imgTag);
buffer.ApplyTag(imgTag, beforeIter, iter);
} else {
@@ -340,6 +348,7 @@ namespace Smuxi.Frontend.Gnome
var beforeIter = buffer.GetIterAtMark(mark);
var emojiTag = new EmojiTag(mark, path);
_MessageTextTagTable.Add(emojiTag);
+ emojiTag.Rise = - descent;
buffer.ApplyTag(emojiTag, beforeIter, afterIter);
return false;
});
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]