From 23280adc070c8623f3929b3b107170aa9f3224ae Mon Sep 17 00:00:00 2001 From: MSVSphere Packaging Team Date: Tue, 26 Nov 2024 16:14:26 +0300 Subject: [PATCH] import google-noto-sans-cjk-fonts-2.004-8.el10 --- .gitignore | 1 + .google-noto-sans-cjk-fonts.metadata | 1 + SOURCES/65-google-noto-sans-cjk-fonts.conf | 112 ++++++++++++ .../65-google-noto-sans-cjk-mono-fonts.conf | 112 ++++++++++++ SOURCES/genfontconf.py | 161 ++++++++++++++++++ SPECS/google-noto-sans-cjk-fonts.spec | 96 +++++++++++ 6 files changed, 483 insertions(+) create mode 100644 .gitignore create mode 100644 .google-noto-sans-cjk-fonts.metadata create mode 100644 SOURCES/65-google-noto-sans-cjk-fonts.conf create mode 100644 SOURCES/65-google-noto-sans-cjk-mono-fonts.conf create mode 100644 SOURCES/genfontconf.py create mode 100644 SPECS/google-noto-sans-cjk-fonts.spec diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..535ca09 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +SOURCES/03_NotoSansCJK-OTC.zip diff --git a/.google-noto-sans-cjk-fonts.metadata b/.google-noto-sans-cjk-fonts.metadata new file mode 100644 index 0000000..8442a73 --- /dev/null +++ b/.google-noto-sans-cjk-fonts.metadata @@ -0,0 +1 @@ +b035fa3027f99bc2c7e864ee6f28d420742d82e8 SOURCES/03_NotoSansCJK-OTC.zip diff --git a/SOURCES/65-google-noto-sans-cjk-fonts.conf b/SOURCES/65-google-noto-sans-cjk-fonts.conf new file mode 100644 index 0000000..e5ac1bb --- /dev/null +++ b/SOURCES/65-google-noto-sans-cjk-fonts.conf @@ -0,0 +1,112 @@ + + + + + + Noto Sans CJK SC + + + + lang + + ja + ko + zh-hk + zh-mo + zh-tw + cmn + hak + lzh + nan + yue + + + + + + + Noto Sans CJK TC + + + + lang + + ja + ko + zh-cn + zh-hk + zh-mo + zh-sg + yue + + + + + + + Noto Sans CJK HK + + + + lang + + ja + ko + zh-cn + zh-sg + zh-tw + cmn + hak + lzh + nan + + + + + + + Noto Sans CJK JP + + + + lang + + ko + zh-cn + zh-hk + zh-mo + zh-sg + zh-tw + cmn + hak + lzh + nan + yue + + + + + + + Noto Sans CJK KR + + + + lang + + ja + zh-cn + zh-hk + zh-mo + zh-sg + zh-tw + cmn + hak + lzh + nan + yue + + + + + diff --git a/SOURCES/65-google-noto-sans-cjk-mono-fonts.conf b/SOURCES/65-google-noto-sans-cjk-mono-fonts.conf new file mode 100644 index 0000000..cdcfb20 --- /dev/null +++ b/SOURCES/65-google-noto-sans-cjk-mono-fonts.conf @@ -0,0 +1,112 @@ + + + + + + Noto Sans Mono CJK SC + + + + lang + + ja + ko + zh-hk + zh-mo + zh-tw + cmn + hak + lzh + nan + yue + + + + + + + Noto Sans Mono CJK TC + + + + lang + + ja + ko + zh-cn + zh-hk + zh-mo + zh-sg + yue + + + + + + + Noto Sans Mono CJK HK + + + + lang + + ja + ko + zh-cn + zh-sg + zh-tw + cmn + hak + lzh + nan + + + + + + + Noto Sans Mono CJK JP + + + + lang + + ko + zh-cn + zh-hk + zh-mo + zh-sg + zh-tw + cmn + hak + lzh + nan + yue + + + + + + + Noto Sans Mono CJK KR + + + + lang + + ja + zh-cn + zh-hk + zh-mo + zh-sg + zh-tw + cmn + hak + lzh + nan + yue + + + + + diff --git a/SOURCES/genfontconf.py b/SOURCES/genfontconf.py new file mode 100644 index 0000000..95fba4c --- /dev/null +++ b/SOURCES/genfontconf.py @@ -0,0 +1,161 @@ +#!/usr/bin/python3 + + +import argparse + + +''' +Generate the font config file for Noto CJK fonts + +genfontconf.py "lang list" "common font name" "font name" "fallback font name" "prepend latin font" ... + +like + +genfontconf.py --fallback-font --prepend-latin-font "zh-cn:zh-sg" "monospace" "Source Han Sans CN" "Source Han Sans TW" "DejaVu Sans Mono" "zh-cn:zh-sg" "serif" "Source Han Sans CN" "Source Han Sans TW" "" "zh-cn:zh-sg" "sans-serif" "Source Han Sans CN" "Source Han Sans TW" "" + +genfontconf.py "zh-cn:zh-sg" "monospace" "Noto Sans Mono CJK SC" "zh-cn:zh-sg" "serif" "Noto Serif CJK SC" "zh-cn:zh-sg" "sans-serif" "Noto Sans CJK SC" + +The above information is in variable length array. +''' + +''' +Some Noto CJK fonts may not need "fallback font name" + +Skip the "fallback font name" argument if not needed. +''' + +fallback_font_name = False + +''' +Noto CJK may not need "prepend latin font". + +Skip the "prepend latin font" argument if not needed. +''' + +prepend_latin_font = False + + +class FontConfRecord: + + @staticmethod + def renderRecord(langlist, common, font, fallback=None, latin=None): + for lang in langlist.split(":"): + FontConfRecord.renderMatch(lang, common, font, fallback, latin) + print() + + FontConfRecord.renderAlias(font, common) + print() + + @staticmethod + def renderMatch(lang, common, font, fallback, latin): + print('') + FontConfRecord.renderTestLang(lang) + FontConfRecord.renderTestFamily(common) + FontConfRecord.renderEditFamily(font, fallback) + FontConfRecord.renderEditLatinFamily(latin) + print('') + + @staticmethod + def renderTestLang(lang): + print('') + print('{0}'.format(lang)) + print('') + + @staticmethod + def renderTestFamily(common): + print('') + print('{0}'.format(common)) + print('') + + @staticmethod + def renderEditFamily(font, fallback): + print('') + print('{0}'.format(font)) + if fallback: + print('{0}'.format(fallback)) + print('') + + @staticmethod + def renderEditLatinFamily(latin): + if not latin: + return + print('') + print('{0}'.format(latin)) + print('') + + @staticmethod + def renderAlias(font, common): + print('') + print('{0}'.format(font)) + print('') + print('{0}'.format(common)) + print('') + print('') + + +class FontConfFile: + + @staticmethod + def renderFile(strings): + FontConfFile.renderHeader() + FontConfFile.renderBody(strings) + FontConfFile.renderFooter() + + @staticmethod + def renderHeader(): + print('') + print('') + print('') + + @staticmethod + def renderBody(strings): + num = 3 + if fallback_font_name: + num += 1 + if prepend_latin_font: + num += 1 + + while len(strings): + items = strings[0:num] + strings = strings[num:] + + if num == 3: + FontConfRecord.renderRecord(items[0], items[1], items[2]) + + if num == 4: + if fallback_font_name: + FontConfRecord.renderRecord \ + (items[0], items[1], items[2], items[3]) + if prepend_latin_font: + FontConfRecord.renderRecord \ + (items[0], items[1], items[2], None, items[3]) + + if num == 5: + FontConfRecord.renderRecord \ + (items[0], items[1], items[2], items[3], items[4]) + + @staticmethod + def renderFooter(): + print('') + + +if __name__ == "__main__": + parser = argparse.ArgumentParser(description='Generate font config.') + parser.add_argument('strings', metavar='string', type=str, nargs='+', + help='strings') + + parser.add_argument('--fallback-font', dest='fallback_font', action='store_true') + parser.add_argument('--disable-fallback-font', dest='fallback_font', action='store_false') + parser.set_defaults(fallback_font=False) + + parser.add_argument('--prepend-latin-font', dest='prepend_latin_font', action='store_true') + parser.add_argument('--disable-prepend-latin-font', dest='prepend_latin_font', action='store_false') + parser.set_defaults(prepend_latin_font=False) + + args = parser.parse_args() + #print(args) + + fallback_font_name = args.fallback_font + prepend_latin_font = args.prepend_latin_font + + FontConfFile.renderFile(args.strings) diff --git a/SPECS/google-noto-sans-cjk-fonts.spec b/SPECS/google-noto-sans-cjk-fonts.spec new file mode 100644 index 0000000..6d77f30 --- /dev/null +++ b/SPECS/google-noto-sans-cjk-fonts.spec @@ -0,0 +1,96 @@ +# SPDX-License-Identifier: MIT + +Epoch: 1 +Version: 2.004 +Release: 8%{?dist} +URL: https://github.com/googlefonts/noto-cjk + +BuildRequires: python3 + +%global foundry Google +%global fontlicense OFL-1.1 +%global fontlicenses LICENSE + +%global fontfamily Noto Sans CJK +%global fontsummary Google Noto Sans CJK Fonts +%global fonts *.ttc +%global fontconfs 65-1-%{fontpkgname}.conf %{SOURCE10} %{SOURCE11} +%global fontdescription %{expand: +Noto CJK fonts, supporting Simplified Chinese, Traditional Chinese, \ +Japanese, and Korean. The supported scripts are Han, Hiragana, Katakana, \ +Hangul, and Bopomofo. Latin, Greek, Cyrllic, and various symbols are also \ +supported for compatibility with CJK standards. + +The google-noto-sans-cjk-fonts package contains Google Noto Sans CJK fonts. +} + +Source0: https://github.com/googlefonts/noto-cjk/releases/download/Sans%{version}/03_NotoSansCJK-OTC.zip +Source1: genfontconf.py +Source10: 65-%{fontpkgname}.conf +Source11: 65-google-noto-sans-cjk-mono-fonts.conf + + +%fontpkg + +%prep +%autosetup -c + +cp %{SOURCE1} . + +python3 genfontconf.py "ja" "monospace" "Noto Sans Mono CJK JP" \ + "ja" "sans-serif" "Noto Sans CJK JP" \ + "ko" "monospace" "Noto Sans Mono CJK KR" \ + "ko" "sans-serif" "Noto Sans CJK KR" \ + "zh-cn:zh-sg" "monospace" "Noto Sans Mono CJK SC" \ + "zh-cn:zh-sg" "sans-serif" "Noto Sans CJK SC" \ + "zh-tw:cmn:hak:lzh:nan" "monospace" "Noto Sans Mono CJK TC" \ + "zh-tw:cmn:hak:lzh:nan" "sans-serif" "Noto Sans CJK TC" \ + "zh-hk:zh-mo:yue" "monospace" "Noto Sans Mono CJK HK" \ + "zh-hk:zh-mo:yue" "sans-serif" "Noto Sans CJK HK" \ + | xmllint --format - |tee 65-1-google-noto-sans-cjk-fonts.conf + + +%build +%fontbuild + +%install +%fontinstall + +%check +%fontcheck + +%fontfiles + +%changelog +* Tue Nov 26 2024 MSVSphere Packaging Team - 1:2.004-8 +- Rebuilt for MSVSphere 10 + +* Mon Jun 24 2024 Troy Dawson - 1:2.004-8 +- Bump release for June 2024 mass rebuild + +* Wed Jan 24 2024 Fedora Release Engineering - 1:2.004-7 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild + +* Sat Jan 20 2024 Fedora Release Engineering - 1:2.004-6 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild + +* Fri Oct 6 2023 Akira TAGOH - 1:2.004-5 +- Drop Conflict: google-noto-sans-cjk-vf-fonts to get them installed together. + fontconfig basically estimate same score for both but static font still has + a priority because of path name. This works as a workaround for some issues + related to variable fonts. + Resolves: rhbz #2240646 + +* Thu Jul 20 2023 Fedora Release Engineering - 1:2.004-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild + +* Fri Mar 24 2023 Peng Wu - 1:2.004-3 +- Fix dnf upgrade issue +- Resolves: RHBZ#2181349 + +* Thu Mar 16 2023 Peng Wu - 1:2.004-2 +- Update the spec file with some Obsoletes and Provides + +* Fri Feb 3 2023 Peng Wu - 1:2.004-1 +- Initial Packaging +- Migrate to SPDX license