fontconfig: Branch 'main' - 2 commits

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



 meson.build           |    1 +
 src/fcfreetype.c      |    3 +++
 test/meson.build      |    7 +++++++
 test/test_issue431.py |   27 +++++++++++++++++++++++++++
 4 files changed, 38 insertions(+)

New commits:
commit bb36802b41edb5e9bf11e235d1f4222b9c4921de
Merge: 712c5be 3a0ed05
Author: Akira TAGOH <akira@xxxxxxxxx>
Date:   Thu Nov 28 04:16:44 2024 +0000

    Merge branch 'issues/431' into 'main'
    
    Use proper postscriptname for named instance if any
    
    See merge request fontconfig/fontconfig!350

commit 3a0ed05722feec5c478d076d87a64bf15f4bacdb
Author: Akira TAGOH <akira@xxxxxxxxx>
Date:   Tue Nov 26 11:50:46 2024 +0900

    Use proper postscriptname for named instance if any
    
    We need to call FT_Set_Named_Instance before FT_Get_Postscript_Name:
      https://freetype.org/freetype2/docs/reference/ft2-information_retrieval.html#ft_get_postscript_name
    
    Fixes https://gitlab.freedesktop.org/fontconfig/fontconfig/-/issues/431

diff --git a/meson.build b/meson.build
index 7d41f84..dd3cfe3 100644
--- a/meson.build
+++ b/meson.build
@@ -81,6 +81,7 @@ endif
 
 pkgmod = import('pkgconfig')
 python3 = import('python').find_installation()
+pytest = find_program('pytest', required: false)
 
 check_headers = [
   ['dirent.h'],
diff --git a/src/fcfreetype.c b/src/fcfreetype.c
index be41ea1..46874c4 100644
--- a/src/fcfreetype.c
+++ b/src/fcfreetype.c
@@ -1772,6 +1772,9 @@ FcFreeTypeQueryFaceInternal (const FT_Face  face,
     {
 	char	    psname[256];
 	const char	    *tmp;
+
+	if (instance)
+            FT_Set_Named_Instance (face, id >> 16);
 	tmp = FT_Get_Postscript_Name (face);
 	if (!tmp)
 	{
diff --git a/test/meson.build b/test/meson.build
index eff0b22..32d7714 100644
--- a/test/meson.build
+++ b/test/meson.build
@@ -61,6 +61,13 @@ if host_machine.system() != 'windows'
   endif
 
   test('run_test_sh', find_program('run-test.sh'), timeout: 600, env: ['srcdir=@0@'.format(meson.current_source_dir()), 'builddir=@0@'.format(meson.current_build_dir()), 'EXEEXT=@0@'.format(conf.get('EXEEXT')), 'VERBOSE=1'])
+
+  if pytest.found()
+    test('pytest', pytest, args: ['--tap'],
+         workdir: meson.current_source_dir(),
+         env: ['builddir=@0@'.format(meson.current_build_dir())],
+         protocol: 'tap')
+  endif
 endif
 
 if jsonc_dep.found()
diff --git a/test/test_issue431.py b/test/test_issue431.py
new file mode 100644
index 0000000..55ca2b4
--- /dev/null
+++ b/test/test_issue431.py
@@ -0,0 +1,27 @@
+#! /usr/bin/env python3
+# Copyright (C) 2024 fontconfig Authors
+# SPDX-License-Identifier: HPND
+
+import os
+import pytest
+import re
+import requests
+import shutil
+import subprocess
+from pathlib import Path
+
+
+def test_issue431(tmp_path):
+    req = requests.get('https://github.com/googlefonts/roboto-flex/releases/download/3.100/roboto-flex-fonts.zip',
+                       allow_redirects=True)
+    with open(tmp_path / 'roboto-flex-fonts.zip', 'wb') as f:
+        f.write(req.content)
+    shutil.unpack_archive(tmp_path / 'roboto-flex-fonts.zip', tmp_path)
+    builddir = Path(os.environ.get('builddir', Path(__file__).parent)).parent
+    result = subprocess.run([builddir / 'fc-query' / 'fc-query', '-f', '%{family[0]}:%{index}:%{style[0]}:%{postscriptname}\n', tmp_path / 'roboto-flex-fonts/fonts/variable/RobotoFlex[GRAD,XOPQ,XTRA,YOPQ,YTAS,YTDE,YTFI,YTLC,YTUC,opsz,slnt,wdth,wght].ttf'], stdout=subprocess.PIPE)
+
+    for line in result.stdout.decode('utf-8').splitlines():
+        family, index, style, psname = line.split(':')
+        normstyle = re.sub('[\x04\\(\\)/<>\\[\\]{}\t\f\r\n ]', '', style)
+        assert psname.split('-')[-1] == normstyle, \
+            f'postscriptname `{psname}\' does not contain style name `{normstyle}\': index {index}'



[Index of Archives]     [Fedora Fonts]     [Fedora Users]     [Fedora Cloud]     [Kernel]     [Fedora Packaging]     [Fedora Desktop]     [PAM]     [Gimp Graphics Editor]     [Yosemite News]

  Powered by Linux