vcl/workben/listfonts.cxx |    9 +++++++++
 1 file changed, 9 insertions(+)

New commits:
commit f82e1596f5d886c60cbf41e9912de77be42eff9f
Author:     Khaled Hosny <kha...@aliftype.com>
AuthorDate: Thu Sep 8 01:25:29 2022 +0200
Commit:     خالد حسني <kha...@aliftype.com>
CommitDate: Thu Sep 8 16:31:25 2022 +0200

    vcl: Sort fonts in workben/listfonts
    
    I only need a stable font order, so I can compare the output across
    invocations.
    
    Change-Id: I8141fd0425cdb638b0bf4bb4faa1889200bf8578
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139621
    Tested-by: Jenkins
    Reviewed-by: خالد حسني <kha...@aliftype.com>

diff --git a/vcl/workben/listfonts.cxx b/vcl/workben/listfonts.cxx
index 00ab5a39120d..c66f964a895d 100644
--- a/vcl/workben/listfonts.cxx
+++ b/vcl/workben/listfonts.cxx
@@ -353,7 +353,16 @@ int ListFonts::Main()
             std::cout.rdbuf(out.rdbuf());
         }
 
+        std::vector<int> aIndices;
         for (int i = 0; i < pOutDev->GetFontFaceCollectionCount(); i++)
+            aIndices.push_back(i);
+
+        std::sort(aIndices.begin(), aIndices.end(), [&](int a, int b) {
+            return 
pOutDev->GetFontMetricFromCollection(a).GetHashValueIgnoreColor()
+                   > 
pOutDev->GetFontMetricFromCollection(b).GetHashValueIgnoreColor();
+        });
+
+        for (const auto& i : aIndices)
         {
             // note: to get the correct font metrics, you actually have to get 
the font metric from the
             // system, and *then* you must set it as the current font of 
OutputDevice... then you need

Reply via email to