2016-04-05 16:24 GMT+02:00 Allan Sandfeld Jensen <k...@carewolf.com>: > On Tuesday 05 April 2016, Elvis Stansvik wrote: >> 2016-04-05 15:12 GMT+02:00 Allan Sandfeld Jensen <k...@carewolf.com>: >> > On Monday 04 April 2016, Elvis Stansvik wrote: >> >> Hi all, >> >> >> >> I'm targeting Qt 5.4.1 and it seems there's no Font.Medium enumeration >> >> >> >> value there? I get: >> >> Unable to assign [undefined] to int >> >> >> >> The font we're using for this app is our company font, which is Gotham >> >> from Hoefler & Co. The weights we need in the UI are Book and Medium, >> >> each defined in its own .otf (but under the same family name >> >> "Gotham"), as shown by the fc-scan output below: >> >> >> >> estan@newton:~$ fc-scan Gotham-Book.otf >> >> Pattern has 22 elts (size 32) >> >> >> >> family: "Gotham"(s) "Gotham Book"(s) >> >> familylang: "en"(s) "en"(s) >> >> style: "Book"(s) "Regular"(s) >> >> stylelang: "en"(s) "en"(s) >> >> fullname: "Gotham-Book"(s) >> >> fullnamelang: "en"(s) >> >> slant: 0(i)(s) >> >> weight: 50(i)(s) >> >> width: 100(i)(s) >> >> foundry: "unknown"(s) >> >> file: "Gotham-Book.otf"(s) >> >> index: 0(i)(s) >> >> outline: True(s) >> >> scalable: True(s) >> >> charset: >> >> 0000: 00000000 ffffffff ffffffff 7fffffff 00000000 ffdfcfaf >> >> >> >> ffffffff ffffffff >> >> >> >> 0001: cffffcff fec3fccf cffff1ff 7ffffc3f 00040000 00000000 >> >> >> >> 00000000 fc000000 >> >> >> >> 0002: 03000000 00000000 02000000 00000000 00000000 00000000 >> >> >> >> 3f0000c0 00000000 >> >> >> >> 0003: 00000000 00000040 00000000 00000000 00000000 00000000 >> >> >> >> 00000000 00000000 >> >> >> >> 000e: 00000000 80000000 00000000 00000000 00000000 00000000 >> >> >> >> 00000000 00000000 >> >> >> >> 001e: 00000000 00000000 00000000 00000000 0000003f 00000000 >> >> >> >> 00000000 000c0000 >> >> >> >> 0020: 771806bc 06010047 00000010 03f10000 000003ff 00021742 >> >> >> >> 00000000 00000000 >> >> >> >> 0021: 00800000 00000005 7ff80000 00000000 00000000 00000000 >> >> >> >> 00000000 00000000 >> >> >> >> 0022: 00040000 00000000 00000000 00000000 00000000 00000000 >> >> >> >> 00000000 00000000 >> >> >> >> 00fb: 0000001f 00000000 00000000 00000000 00000000 00000000 >> >> >> >> 00000000 00000000 >> >> (s) >> >> >> >> lang: >> >> aa|ay|bi|br|bs|ca|ch|co|cs|cy|da|de|en|es|et|eu|fi|fj|fo|fr|fur|fy|gd|gl >> >> |g >> >> v|ho|hr|hu|ia|id|ie|io|is|it|la|lb|lt|lv|mg|mh|mt|nb|nds|nl|nn|no|nr|ns >> >> o|ny >> >> >> >> |oc|om|pl|pt|rm|sk|sl|sma|smj|so|sq|ss|st|sv|sw|tk|tl|tn|tr|ts|uz|vo|vot >> >> ||wa >> >> |wen|xh|yap|zu|an|crh|csb|fil|hsb|ht|jv|kj|ku-tr|kwm|li|ms|ng|pap-an|pa >> >> |p-aw rn|rw|sc|sg|sn|su|za(s) fontversion: 144179(i)(s) >> >> | >> >> capability: "otlayout: otlayout:latn"(s) >> >> fontformat: "CFF"(s) >> >> decorative: False(s) >> >> >> >> hash: >> >> "sha256:3083f405cb35b16e06d0108836dd6552630c85c7fc5412a5de724e57e6fd7348 >> >> "( s) postscriptname: "Gotham-Book"(s) >> >> >> >> estan@newton:~$ fc-scan Gotham-Medium.otf >> >> Pattern has 22 elts (size 32) >> >> >> >> family: "Gotham"(s) "Gotham Medium"(s) >> >> familylang: "en"(s) "en"(s) >> >> style: "Medium"(s) "Regular"(s) >> >> stylelang: "en"(s) "en"(s) >> >> fullname: "Gotham-Medium"(s) >> >> fullnamelang: "en"(s) >> >> slant: 0(i)(s) >> >> weight: 80(i)(s) >> >> width: 100(i)(s) >> >> foundry: "unknown"(s) >> >> file: "Gotham-Medium.otf"(s) >> >> index: 0(i)(s) >> >> outline: True(s) >> >> scalable: True(s) >> >> charset: >> >> 0000: 00000000 ffffffff ffffffff 7fffffff 00000000 ffdfcfaf >> >> >> >> ffffffff ffffffff >> >> >> >> 0001: cffffcff fec3fccf cffff1ff 7ffffc3f 00040000 00000000 >> >> >> >> 00000000 fc000000 >> >> >> >> 0002: 03000000 00000000 02000000 00000000 00000000 00000000 >> >> >> >> 3f0000c0 00000000 >> >> >> >> 0003: 00000000 00000040 00000000 00000000 00000000 00000000 >> >> >> >> 00000000 00000000 >> >> >> >> 000e: 00000000 80000000 00000000 00000000 00000000 00000000 >> >> >> >> 00000000 00000000 >> >> >> >> 001e: 00000000 00000000 00000000 00000000 0000003f 00000000 >> >> >> >> 00000000 000c0000 >> >> >> >> 0020: 771806bc 06010047 00000010 03f10000 000003ff 00021742 >> >> >> >> 00000000 00000000 >> >> >> >> 0021: 00800000 00000005 7ff80000 00000000 00000000 00000000 >> >> >> >> 00000000 00000000 >> >> >> >> 0022: 00040000 00000000 00000000 00000000 00000000 00000000 >> >> >> >> 00000000 00000000 >> >> >> >> 00fb: 0000001f 00000000 00000000 00000000 00000000 00000000 >> >> >> >> 00000000 00000000 >> >> (s) >> >> >> >> lang: >> >> aa|ay|bi|br|bs|ca|ch|co|cs|cy|da|de|en|es|et|eu|fi|fj|fo|fr|fur|fy|gd|gl >> >> |g >> >> v|ho|hr|hu|ia|id|ie|io|is|it|la|lb|lt|lv|mg|mh|mt|nb|nds|nl|nn|no|nr|ns >> >> o|ny >> >> >> >> |oc|om|pl|pt|rm|sk|sl|sma|smj|so|sq|ss|st|sv|sw|tk|tl|tn|tr|ts|uz|vo|vot >> >> ||wa >> >> |wen|xh|yap|zu|an|crh|csb|fil|hsb|ht|jv|kj|ku-tr|kwm|li|ms|ng|pap-an|pa >> >> |p-aw rn|rw|sc|sg|sn|su|za(s) fontversion: 144179(i)(s) >> >> | >> >> capability: "otlayout: otlayout:latn"(s) >> >> fontformat: "CFF"(s) >> >> decorative: False(s) >> >> >> >> hash: >> >> "sha256:bc397773a547218b8c334f9a40ea8e58f55198fab6095b103e598634fe273450 >> >> "( s) postscriptname: "Gotham-Medium"(s) >> >> >> >> estan@newton:~/orexplore/doc/GrafiskProfil/Typsnitt/Gotham$ >> >> >> >> And I'm loading these as follows: >> >> >> >> Style { >> >> >> >> readonly property string mediumFontFamily: __gothamMediumLoader.name >> >> readonly property string regularFontFamily: __gothamBookLoader.name >> >> >> >> property FontLoader __gothamBookLoader: FontLoader { >> >> >> >> source: "fonts/Gotham-Book.otf" >> >> >> >> } >> >> >> >> property FontLoader __gothamMediumLoader: FontLoader { >> >> >> >> source: "fonts/Gotham-Medium.otf" >> >> >> >> } >> >> >> >> ... >> >> >> >> } >> >> >> >> and trying to use them with: >> >> >> >> Text { >> >> >> >> text: "Foo" >> >> font.family: Style.regularFontFamily >> >> font.weight: Font.Normal >> >> >> >> } >> >> >> >> Text { >> >> >> >> text: "Foo" >> >> font.family: Style.mediumFontFamily >> >> font.weight: Font.Medium >> >> >> >> } >> > >> > Have you tried: >> > font.styleName: "Medium" >> > >> > styleName is the most direct way to select a specific style of a font >> > without having to go through matching of style property which may be >> > wrongly encoded in the font . >> >> Ah yes, that will probably work. That's what I meant with: >> >> "It seems there's some fixes in 5.6 which will let me use >> Font.styleName to match a font by style name, which would be a >> workaround [1]. But right now I'm stuck with 5.4.1." >> >> Completely understandable if you missed that, sorry for sending such a >> tirade of e-mails! >> > Ah, sorry. Yes it is pretty difficult with Qt 5.4, it also doesn't understand > the Medium font weight (I think that got added in 5.5). Probably renaming the > fonts is the best solution if you can't upgrade Qt.
Yep, it's what I'll do until we can upgrade (when it's in Ubuntu). Elvis > > Best Regards > `Allan _______________________________________________ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest