2016-04-04 16:32 GMT+02:00 Elvis Stansvik <elvst...@gmail.com>: > 2016-04-04 16:21 GMT+02:00 Elvis Stansvik <elvst...@gmail.com>: >> 2016-04-04 15:51 GMT+02:00 Elvis Stansvik <elvst...@gmail.com>: >>> 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|gv|ho|hr|hu|ia|id|ie|io|is|it|la|lb|lt|lv|mg|mh|mt|nb|nds|nl|nn|no|nr|nso|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|pap-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|gv|ho|hr|hu|ia|id|ie|io|is|it|la|lb|lt|lv|mg|mh|mt|nb|nds|nl|nn|no|nr|nso|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|pap-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 >>> } >>> >>> the Font.Normal seems to work okay, it looks like it's giving me the >>> Book weight from Gotham-Book.otf, which I want. I guess because the >>> weight is close numerically (?) >>> >>> But what do I do with the Medium weight since the enum value is not >>> available? If I try Font.Bold I seem to get synthetic emboldening, >>> which I don't want. >>> >>> 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. >>> >>> Thanks in advance for any advice. >> >> Wait! It seems I've been saved by the Font.DemiBold enum value. If I >> use Font.DemiBold (which _is_ available in Qt 5.4.1) like this: >> >> font.family: "Gotham" >> font.weight: Font.DemiBold >> >> I can get the Medium weight font, I guess since it's the one closest >> numerically to DemiBold. >> >> And I can keep using: >> >> font.family: "Gotham" >> font.weight: Font.Normal >> >> to get the Book weight. >> >> So, close call, but all is well. Sorry for the noise! > > Well bah, was actually working on the wrong machine when testing some > of the above. So the story now is: > > * I can get the Medium weight fine as described above (by specifying > Font.DemiBold). > * I can _not_ get the Book weight, specifying Font.Normal (or omitting > weight completely) gets me Medium :( > > So anyone know how I can make it load the Book weight? I can not > specify Font.Thin, because then it loads the Thin weight font (which I > also have). My guess is it would work with Thin if uninstall the Thin > weight font, so that the Book weight would then be the closest one > numerically. But I can't do that since I actually need to use the Thin > one in some places :/
I confirmed that removing the Light weight font, I can use Font.Light to get at the Book weight. But it doesn't solve my problem since I need to be able to access all three weights (Light, Book, Medium), and they seem spread out weight-wise in a very bad way such that the granularity of the Font weight enum in Qt 5.4.1 is not sufficient to access them all :/ Elvis > > Elvis > >> >> Elvis >> >>> >>> Elvis >>> >>> [1] https://codereview.qt-project.org/#/c/112676/ _______________________________________________ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest