Commit c7004d99 authored by Pierre Lamot's avatar Pierre Lamot
Browse files

qml: fix icon misaligned with on some systems

  Defining the scale transform within the font resulted in vertical misalignment
  on some systems.
parent 1cb6ffe3
......@@ -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
......
......@@ -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
......
......@@ -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
......
......@@ -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"
......
......@@ -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
......
......@@ -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
......
......@@ -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
}
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment