Bug 101351

Summary: FcLangSetCompare() gives an incorrect result when two charsets come from different "buckets" of fcLangCountrySets
Product: fontconfig Reporter: Florent Rougon <f.rougon>
Component: libraryAssignee: fontconfig-bugs
Status: RESOLVED FIXED QA Contact: Behdad Esfahbod <freedesktop>
Severity: normal    
Priority: medium CC: akira
Version: 2.12   
Hardware: All   
OS: All   
Whiteboard:
i915 platform: i915 features:
Attachments: Commit (as output by 'git format-patch')

Description Florent Rougon 2017-06-08 14:07:49 UTC
Created attachment 131804 [details] [review]
Commit (as output by 'git format-patch')

As written at: https://lists.freedesktop.org/archives/fontconfig/2017-June/005944.html

In fcLangCountrySets, it may happen that two charsets for the same
language but different territories are found in different FcChar32
"buckets" (different "columns" on the same line). This is currently the
case for the following pairs:

  mn-cn  and mn-mn
  pap-an and pap-aw

The FcLangSetCompare() code in current 'master' returns
FcLangDifferentLang instead of FcLangDifferentTerritory when
comparing:

  an FcLangSet containing only mn-cn with one containing only mn-mn

or

  an FcLangSet containing only pap-an with one containing only pap-aw

The attached patch fixes this problem.
Comment 1 Akira TAGOH 2017-06-12 05:28:24 UTC
Thanks. merged and added a testcase for this.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.