[vlc-commits] qml: fix icon misaligned with on some systems
Pierre Lamot
git at videolan.org
Thu Feb 20 13:56:55 CET 2020
vlc | branch: master | Pierre Lamot <pierre at videolabs.io> | Wed Feb 19 16:27:49 2020 +0100| [20fefd3e166a362e185abfe7f7e5866927a6e08d] | committer: Jean-Baptiste Kempf
qml: fix icon misaligned with on some systems
Defining the scale transform within the font resulted in vertical misalignment
on some systems.
Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=20fefd3e166a362e185abfe7f7e5866927a6e08d
---
.../qt/dialogs/toolbar/qml/EditorDummyButton.qml | 2 +-
modules/gui/qt/pixmaps/VLCIcons.ttf | Bin 25776 -> 26804 bytes
modules/gui/qt/pixmaps/makeIconFont.py | 10 +++++++++-
modules/gui/qt/player/qml/ControlButtons.qml | 4 ++--
modules/gui/qt/style/VLCIcons.qml | 4 ++++
modules/gui/qt/widgets/qml/ContextButton.qml | 2 +-
modules/gui/qt/widgets/qml/IconToolButton.qml | 6 +++---
modules/gui/qt/widgets/qml/TabButtonExt.qml | 2 +-
8 files changed, 21 insertions(+), 9 deletions(-)
diff --git a/modules/gui/qt/dialogs/toolbar/qml/EditorDummyButton.qml b/modules/gui/qt/dialogs/toolbar/qml/EditorDummyButton.qml
index 70349f5b94..012d03fcf2 100644
--- a/modules/gui/qt/dialogs/toolbar/qml/EditorDummyButton.qml
+++ b/modules/gui/qt/dialogs/toolbar/qml/EditorDummyButton.qml
@@ -25,7 +25,7 @@ import "qrc:///style/"
Label {
color: VLCStyle.colors.buttonText
- font.pixelSize: VLCStyle.icon_medium
+ font.pixelSize: VLCIcons.pixelSize(VLCStyle.icon_medium)
font.family: VLCIcons.fontFamily
verticalAlignment: Text.AlignVCenter
diff --git a/modules/gui/qt/pixmaps/VLCIcons.ttf b/modules/gui/qt/pixmaps/VLCIcons.ttf
index 3e46e0a6ae..7bee385d90 100644
Binary files a/modules/gui/qt/pixmaps/VLCIcons.ttf and b/modules/gui/qt/pixmaps/VLCIcons.ttf differ
diff --git a/modules/gui/qt/pixmaps/makeIconFont.py b/modules/gui/qt/pixmaps/makeIconFont.py
index 6492ad808c..f28185affc 100755
--- a/modules/gui/qt/pixmaps/makeIconFont.py
+++ b/modules/gui/qt/pixmaps/makeIconFont.py
@@ -56,6 +56,10 @@ Item {
property string fontFamily: "{{font_name}}"
+ function pixelSize(size) {
+ return size * 0.6
+ }
+
// Icons
{% for f in glyphs %} property string {{f.key}} : "{{f.charcode}}"
{% endfor %}
@@ -90,13 +94,17 @@ def main(model_fd):
font.familyname = data["font_name"]
font.fontname = data["font_name"]
font.design_size = 1000.0
+ font.ascent = 800
+ font.descent = 200
+ #we might need to specify ascent/descent of hhea_ os2_typo os2_win
+
for i, glyph in enumerate(data["glyphs"]):
charcode = UTF8_AREA + i
c = font.createChar(charcode)
glyph["charcode"] = "\\u{:x}".format(charcode)
c.importOutlines(glyph["path"])
#scale glyph to fit between 200 (base line) and 800 (x 0.6)
- c.transform((0.6, 0.0, 0.0, 0.6, 200.0, 200.0))
+ #c.transform((0.6, 0.0, 0.0, 0.6, 200, 200.))
c.vwidth = 1000
c.width = 1000
diff --git a/modules/gui/qt/player/qml/ControlButtons.qml b/modules/gui/qt/player/qml/ControlButtons.qml
index eb77c4c432..0811812b7d 100644
--- a/modules/gui/qt/player/qml/ControlButtons.qml
+++ b/modules/gui/qt/player/qml/ControlButtons.qml
@@ -372,7 +372,7 @@ Item{
anchors.centerIn: parent
- font.pixelSize: VLCStyle.icon_medium
+ font.pixelSize: VLCIcons.pixelSize(VLCStyle.icon_medium)
font.family: VLCIcons.fontFamily
verticalAlignment: Text.AlignVCenter
@@ -399,7 +399,7 @@ Item{
anchors.centerIn: parent
- font.pixelSize: VLCStyle.icon_medium
+ font.pixelSize: VLCIcons.pixelSize(VLCStyle.icon_medium)
font.family: VLCIcons.fontFamily
verticalAlignment: Text.AlignVCenter
diff --git a/modules/gui/qt/style/VLCIcons.qml b/modules/gui/qt/style/VLCIcons.qml
index 025458e950..96af332b82 100644
--- a/modules/gui/qt/style/VLCIcons.qml
+++ b/modules/gui/qt/style/VLCIcons.qml
@@ -12,6 +12,10 @@ Item {
property string fontFamily: "VLCIcons"
+ function pixelSize(size) {
+ return size * 0.6
+ }
+
// Icons
property string eject : "\ue000"
property string stop : "\ue001"
diff --git a/modules/gui/qt/widgets/qml/ContextButton.qml b/modules/gui/qt/widgets/qml/ContextButton.qml
index 72eeba5712..8f0f19052e 100644
--- a/modules/gui/qt/widgets/qml/ContextButton.qml
+++ b/modules/gui/qt/widgets/qml/ContextButton.qml
@@ -28,7 +28,7 @@ Button {
height: VLCStyle.icon_normal
text: VLCIcons.ellipsis
font.family: VLCIcons.fontFamily
- font.pointSize: VLCStyle.icon_small
+ font.pixelSize: VLCIcons.pixelSize(VLCStyle.icon_medium)
property alias color: contextButtonContent.color
property alias backgroundColor: contextButtonBg.color
diff --git a/modules/gui/qt/widgets/qml/IconToolButton.qml b/modules/gui/qt/widgets/qml/IconToolButton.qml
index 8f04109311..c4faac5ab8 100644
--- a/modules/gui/qt/widgets/qml/IconToolButton.qml
+++ b/modules/gui/qt/widgets/qml/IconToolButton.qml
@@ -46,7 +46,7 @@ ToolButton {
anchors.centerIn: parent
- font.pixelSize: control.size
+ font.pixelSize: VLCIcons.pixelSize(control.size)
font.family: VLCIcons.fontFamily
font.underline: control.font.underline
@@ -61,7 +61,7 @@ ToolButton {
anchors.centerIn: parent
- font.pixelSize: control.size
+ font.pixelSize: VLCIcons.pixelSize(control.size)
font.family: VLCIcons.fontFamily
verticalAlignment: Text.AlignVCenter
@@ -78,7 +78,7 @@ ToolButton {
anchors.centerIn: parent
- font.pixelSize: control.size
+ font.pixelSize: VLCIcons.pixelSize(control.size)
font.family: VLCIcons.fontFamily
verticalAlignment: Text.AlignVCenter
diff --git a/modules/gui/qt/widgets/qml/TabButtonExt.qml b/modules/gui/qt/widgets/qml/TabButtonExt.qml
index 06e206906b..bcc6aacd53 100644
--- a/modules/gui/qt/widgets/qml/TabButtonExt.qml
+++ b/modules/gui/qt/widgets/qml/TabButtonExt.qml
@@ -75,7 +75,7 @@ T.TabButton {
text: control.iconTxt
color: VLCStyle.colors.buttonText
- font.pixelSize: VLCStyle.icon_topbar
+ font.pixelSize: VLCIcons.pixelSize(VLCStyle.icon_topbar)
font.family: VLCIcons.fontFamily
}
}
More information about the vlc-commits
mailing list