On Fri, 6 Nov 2026 21:06:25 GMT, Alexander Zvegintsev <[email protected]> wrote:
>> I moved the calls down to right before the loop. >> I don't actually see how the calls could fail - these are standard >> properties and fontconfig should always return a value. >> But I initialized sensible defaults so that if the call fails, we use those >> defaults. >> >> I also updated the test to compare each style of a font against the same >> style of the other fonts. > >> I don't actually see how the calls could fail - these are standard >> properties and fontconfig should always return a value. > > `FcPatternGetInteger` can return `FcResultTypeMismatch` even for a standard > property such as `FC_WEIGHT`. > e.g. [this report](https://bugzilla.redhat.com/show_bug.cgi?id=1813187#c4) > describes a variable font’s meta face whose weight is represented as a > `FcTypeRange`, and not the `FcTypeInteger`. > > The recently added filename check does not exclude every variable font, so it > does not rule out this case. > > So it is safer to check for the return value. If it did fail, then what I'd do is set the value to the value I've pre-initialized it to - in the event of failure fontconfig does not write anything to the passed in pointer, so a check for failure would be a longer-winded way of getting to the same result. Moreover the FcTypeRange is specifically going to be returned only when you've asked for information about a variable font file. Here we are being handed a *specific instance* in the file not the "meta font" info. So it will never be FcTypeRange. And as I wrote above, it doesn't matter anyway. One thing that came out of those links is that I realised that FC_VARIABLE offers a path to a better way of checking we do have a variable font. So I've made those changes and tested them and will push it now. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/33761#discussion_r4518890356
