mirror of
https://github.com/lvgl/lvgl.git
synced 2026-05-21 22:52:46 +08:00
feat(font): Replace SimSun font with SourceHanSansSC (#8006)
This commit is contained in:
@@ -36,7 +36,7 @@ LV_FONT_MONTSERRAT_46 1
|
||||
LV_FONT_MONTSERRAT_48 1
|
||||
LV_FONT_MONTSERRAT_28_COMPRESSED 1
|
||||
LV_FONT_DEJAVU_16_PERSIAN_HEBREW 1
|
||||
LV_FONT_SIMSUN_16_CJK 1
|
||||
LV_FONT_SOURCE_HAN_SANS_SC_16_CJK 1
|
||||
LV_FONT_UNSCII_8 1
|
||||
|
||||
LV_USE_IMGFONT 1
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
name: Verify Font License
|
||||
on:
|
||||
push:
|
||||
pull_request:
|
||||
|
||||
# https://docs.github.com/en/actions/writing-workflows/workflow-syntax-for-github-actions#concurrency
|
||||
# Ensure that only one commit will be running tests at a time on each push
|
||||
concurrency:
|
||||
group: ${{ github.ref }}-${{ github.workflow }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
verify-font-license:
|
||||
if: ${{ github.event_name != 'pull_request' || github.repository != github.event.pull_request.head.repo.full_name }}
|
||||
runs-on: ubuntu-24.04
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
persist-credentials: false
|
||||
fetch-depth: 0
|
||||
- name: Setup Python
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: 3.12
|
||||
- name: Run font_license_verify.py
|
||||
run: python3 -m pip install fonttools && python font_license_verify.py --no-strict
|
||||
working-directory: scripts
|
||||
@@ -858,6 +858,10 @@ menu "LVGL configuration"
|
||||
bool "Enable Simsun 14 CJK"
|
||||
config LV_FONT_SIMSUN_16_CJK
|
||||
bool "Enable Simsun 16 CJK"
|
||||
config LV_FONT_SOURCE_HAN_SANS_SC_14_CJK
|
||||
bool "Enable SourceHanSansSC 14 CJK"
|
||||
config LV_FONT_SOURCE_HAN_SANS_SC_16_CJK
|
||||
bool "Enable SourceHanSansSC 16 CJK"
|
||||
|
||||
config LV_FONT_UNSCII_8
|
||||
bool "Enable UNSCII 8 (Perfect monospace font)"
|
||||
@@ -948,6 +952,12 @@ menu "LVGL configuration"
|
||||
config LV_FONT_DEFAULT_SIMSUN_16_CJK
|
||||
bool "Simsun 16 CJK"
|
||||
select LV_FONT_SIMSUN_16_CJK
|
||||
config LV_FONT_DEFAULT_SOURCE_HAN_SANS_SC_14_CJK
|
||||
bool "SourceHanSansSC 14 CJK"
|
||||
select LV_FONT_SOURCE_HAN_SANS_SC_14_CJK
|
||||
config LV_FONT_DEFAULT_SOURCE_HAN_SANS_SC_16_CJK
|
||||
bool "SourceHanSansSC 16 CJK"
|
||||
select LV_FONT_SOURCE_HAN_SANS_SC_16_CJK
|
||||
config LV_FONT_DEFAULT_UNSCII_8
|
||||
bool "UNSCII 8 (Perfect monospace font)"
|
||||
select LV_FONT_UNSCII_8
|
||||
|
||||
@@ -378,7 +378,7 @@ lv_obj_align(rtl_label, LV_ALIGN_LEFT_MID, 5, 0);
|
||||
lv_obj_t * cz_label = lv_label_create(lv_screen_active());
|
||||
lv_label_set_text(cz_label,
|
||||
"嵌入式系统(Embedded System),\n是一种嵌入机械或电气系统内部、具有专一功能和实时计算性能的计算机系统。");
|
||||
lv_obj_set_style_text_font(cz_label, &lv_font_simsun_16_cjk, 0);
|
||||
lv_obj_set_style_text_font(cz_label, &lv_font_source_han_sans_sc_16_cjk, 0);
|
||||
lv_obj_set_width(cz_label, 310);
|
||||
lv_obj_align(cz_label, LV_ALIGN_BOTTOM_LEFT, 5, -5);
|
||||
```
|
||||
@@ -403,10 +403,10 @@ rtl_label.set_style_text_font(lv.font_dejavu_16_persian_hebrew, 0)
|
||||
rtl_label.set_width(310)
|
||||
rtl_label.align(lv.ALIGN.LEFT_MID, 5, 0)
|
||||
|
||||
font_simsun_16_cjk = lv.font_load("S:../../assets/font/lv_font_simsun_16_cjk.fnt")
|
||||
font_hans_sans_16_cjk = lv.font_load("S:../../assets/font/lv_font_source_han_sans_sc_16_cjk.fnt")
|
||||
|
||||
cz_label = lv.label(lv.screen_active())
|
||||
cz_label.set_style_text_font(font_simsun_16_cjk, 0)
|
||||
cz_label.set_style_text_font(font_hans_sans_16_cjk, 0)
|
||||
cz_label.set_text("嵌入式系统(Embedded System),\n是一种嵌入机械或电气系统内部、具有专一功能和实时计算性能的计算机系统。")
|
||||
cz_label.set_width(310)
|
||||
cz_label.align(lv.ALIGN.BOTTOM_LEFT, 5, -5)
|
||||
|
||||
+3
-3
@@ -333,7 +333,7 @@ lv_obj_align(rtl_label, LV_ALIGN_LEFT_MID, 5, 0);
|
||||
lv_obj_t * cz_label = lv_label_create(lv_screen_active());
|
||||
lv_label_set_text(cz_label,
|
||||
"嵌入式系统(Embedded System),\n是一种嵌入机械或电气系统内部、具有专一功能和实时计算性能的计算机系统。");
|
||||
lv_obj_set_style_text_font(cz_label, &lv_font_simsun_16_cjk, 0);
|
||||
lv_obj_set_style_text_font(cz_label, &lv_font_source_han_sans_sc_16_cjk, 0);
|
||||
lv_obj_set_width(cz_label, 310);
|
||||
lv_obj_align(cz_label, LV_ALIGN_BOTTOM_LEFT, 5, -5);
|
||||
```
|
||||
@@ -358,10 +358,10 @@ rtl_label.set_style_text_font(lv.font_dejavu_16_persian_hebrew, 0)
|
||||
rtl_label.set_width(310)
|
||||
rtl_label.align(lv.ALIGN.LEFT_MID, 5, 0)
|
||||
|
||||
font_simsun_16_cjk = lv.font_load("S:../../assets/font/lv_font_simsun_16_cjk.fnt")
|
||||
font_han_sans_16_cjk = lv.font_load("S:../../assets/font/lv_font_source_han_sans_sc_16_cjk.fnt")
|
||||
|
||||
cz_label = lv.label(lv.screen_active())
|
||||
cz_label.set_style_text_font(font_simsun_16_cjk, 0)
|
||||
cz_label.set_style_text_font(font_han_sans_16_cjk, 0)
|
||||
cz_label.set_text("嵌入式系统(Embedded System),\n是一种嵌入机械或电气系统内部、具有专一功能和实时计算性能的计算机系统。")
|
||||
cz_label.set_width(310)
|
||||
cz_label.align(lv.ALIGN.BOTTOM_LEFT, 5, -5)
|
||||
|
||||
@@ -361,7 +361,7 @@ lv_obj_align(rtl_label, LV_ALIGN_LEFT_MID, 5, 0);
|
||||
lv_obj_t * cz_label = lv_label_create(lv_screen_active());
|
||||
lv_label_set_text(cz_label,
|
||||
"嵌入式系统(Embedded System),\n是一种嵌入机械或电气系统内部、具有专一功能和实时计算性能的计算机系统。");
|
||||
lv_obj_set_style_text_font(cz_label, &lv_font_simsun_16_cjk, 0);
|
||||
lv_obj_set_style_text_font(cz_label, &lv_font_source_han_sans_sc_16_cjk, 0);
|
||||
lv_obj_set_width(cz_label, 310);
|
||||
lv_obj_align(cz_label, LV_ALIGN_BOTTOM_LEFT, 5, -5);
|
||||
```
|
||||
@@ -386,10 +386,10 @@ rtl_label.set_style_text_font(lv.font_dejavu_16_persian_hebrew, 0)
|
||||
rtl_label.set_width(310)
|
||||
rtl_label.align(lv.ALIGN.LEFT_MID, 5, 0)
|
||||
|
||||
font_simsun_16_cjk = lv.font_load("S:../../assets/font/lv_font_simsun_16_cjk.fnt")
|
||||
font_han_sans_16_cjk = lv.font_load("S:../../assets/font/lv_font_source_han_sans_sc_16_cjk.fnt")
|
||||
|
||||
cz_label = lv.label(lv.screen_active())
|
||||
cz_label.set_style_text_font(font_simsun_16_cjk, 0)
|
||||
cz_label.set_style_text_font(font_han_sans_16_cjk, 0)
|
||||
cz_label.set_text("嵌入式系统(Embedded System),\n是一种嵌入机械或电气系统内部、具有专一功能和实时计算性能的计算机系统。")
|
||||
cz_label.set_width(310)
|
||||
cz_label.align(lv.ALIGN.BOTTOM_LEFT, 5, -5)
|
||||
|
||||
+3
-3
@@ -402,7 +402,7 @@ lv_obj_align(rtl_label, LV_ALIGN_LEFT_MID, 5, 0);
|
||||
lv_obj_t * cz_label = lv_label_create(lv_screen_active());
|
||||
lv_label_set_text(cz_label,
|
||||
"嵌入式系统(Embedded System),\n是一种嵌入机械或电气系统内部、具有专一功能和实时计算性能的计算机系统。");
|
||||
lv_obj_set_style_text_font(cz_label, &lv_font_simsun_16_cjk, 0);
|
||||
lv_obj_set_style_text_font(cz_label, &lv_font_source_han_sans_sc_16_cjk, 0);
|
||||
lv_obj_set_width(cz_label, 310);
|
||||
lv_obj_align(cz_label, LV_ALIGN_BOTTOM_LEFT, 5, -5);
|
||||
```
|
||||
@@ -427,10 +427,10 @@ rtl_label.set_style_text_font(lv.font_dejavu_16_persian_hebrew, 0)
|
||||
rtl_label.set_width(310)
|
||||
rtl_label.align(lv.ALIGN.LEFT_MID, 5, 0)
|
||||
|
||||
font_simsun_16_cjk = lv.font_load("S:../../assets/font/lv_font_simsun_16_cjk.fnt")
|
||||
font_han_sans_16_cjk = lv.font_load("S:../../assets/font/lv_font_source_han_sans_sc_16_cjk.fnt")
|
||||
|
||||
cz_label = lv.label(lv.screen_active())
|
||||
cz_label.set_style_text_font(font_simsun_16_cjk, 0)
|
||||
cz_label.set_style_text_font(font_han_sans_16_cjk, 0)
|
||||
cz_label.set_text("嵌入式系统(Embedded System),\n是一种嵌入机械或电气系统内部、具有专一功能和实时计算性能的计算机系统。")
|
||||
cz_label.set_width(310)
|
||||
cz_label.align(lv.ALIGN.BOTTOM_LEFT, 5, -5)
|
||||
|
||||
@@ -32,7 +32,7 @@ you can disable :c:macro:`LV_IME_PINYIN_USE_DEFAULT_DICT` in ``lv_conf.h``,
|
||||
which can save a lot of memory space.
|
||||
|
||||
The built-in thesaurus is customized based on the
|
||||
**LV_FONT_SIMSUN_16_CJK** font library, which currently has more
|
||||
**LV_FONT_SOURCE_HAN_SANS_SC_16_CJK** font library, which currently has more
|
||||
than 1,000 of the most common CJK radicals, so it is recommended to use a
|
||||
custom font and thesaurus.
|
||||
|
||||
|
||||
@@ -124,7 +124,7 @@ Special fonts
|
||||
|
||||
- :c:macro:`LV_FONT_MONTSERRAT_28_COMPRESSED`: Same as normal 28 px font but stored as a :ref:`fonts_compressed` with 3 bpp
|
||||
- :c:macro:`LV_FONT_DEJAVU_16_PERSIAN_HEBREW`: 16 px font with normal range + Hebrew, Arabic, Persian letters and all their forms
|
||||
- :c:macro:`LV_FONT_SIMSUN_16_CJK`: 16 px font with normal range plus 1000 of the most common CJK radicals
|
||||
- :c:macro:`LV_FONT_SOURCE_HAN_SANS_SC_16_CJK`: 16 px font with normal range plus 1000 of the most common CJK radicals
|
||||
- :c:macro:`LV_FONT_UNSCII_8`: 8 px pixel perfect font with only ASCII characters
|
||||
- :c:macro:`LV_FONT_UNSCII_16`: 16 px pixel perfect font with only ASCII characters
|
||||
|
||||
|
||||
@@ -503,8 +503,8 @@
|
||||
<file category="sourceC" name="src/font/lv_font_montserrat_44.c" />
|
||||
<file category="sourceC" name="src/font/lv_font_montserrat_46.c" />
|
||||
<file category="sourceC" name="src/font/lv_font_montserrat_48.c" />
|
||||
<file category="sourceC" name="src/font/lv_font_simsun_16_cjk.c" />
|
||||
<file category="sourceC" name="src/font/lv_font_simsun_14_cjk.c" />
|
||||
<file category="sourceC" name="src/font/lv_font_source_han_sans_sc_16_cjk.c" />
|
||||
<file category="sourceC" name="src/font/lv_font_source_han_sans_sc_14_cjk.c" />
|
||||
<file category="sourceC" name="src/font/lv_font_unscii_8.c" />
|
||||
<file category="sourceC" name="src/font/lv_font_unscii_16.c" />
|
||||
|
||||
|
||||
@@ -548,10 +548,10 @@
|
||||
#define LV_FONT_MONTSERRAT_48 0
|
||||
|
||||
/* Demonstrate special features */
|
||||
#define LV_FONT_MONTSERRAT_28_COMPRESSED 0 /**< bpp = 3 */
|
||||
#define LV_FONT_DEJAVU_16_PERSIAN_HEBREW 0 /**< Hebrew, Arabic, Persian letters and all their forms */
|
||||
#define LV_FONT_SIMSUN_14_CJK 0 /**< 1000 most common CJK radicals */
|
||||
#define LV_FONT_SIMSUN_16_CJK 0 /**< 1000 most common CJK radicals */
|
||||
#define LV_FONT_MONTSERRAT_28_COMPRESSED 0 /**< bpp = 3 */
|
||||
#define LV_FONT_DEJAVU_16_PERSIAN_HEBREW 0 /**< Hebrew, Arabic, Persian letters and all their forms */
|
||||
#define LV_FONT_SOURCE_HAN_SANS_SC_14_CJK 0 /**< 1000 most common CJK radicals */
|
||||
#define LV_FONT_SOURCE_HAN_SANS_SC_16_CJK 0 /**< 1000 most common CJK radicals */
|
||||
|
||||
/** Pixel perfect monospaced fonts */
|
||||
#define LV_FONT_UNSCII_8 0
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#include "../../lv_examples.h"
|
||||
#if LV_USE_LABEL && LV_USE_TEXTAREA && LV_FONT_SIMSUN_16_CJK && LV_USE_IME_PINYIN && LV_BUILD_EXAMPLES
|
||||
#if LV_USE_LABEL && LV_USE_TEXTAREA && LV_FONT_SOURCE_HAN_SANS_SC_16_CJK && LV_USE_IME_PINYIN && LV_BUILD_EXAMPLES
|
||||
|
||||
static void ta_event_cb(lv_event_t * e)
|
||||
{
|
||||
@@ -23,13 +23,13 @@ static void ta_event_cb(lv_event_t * e)
|
||||
void lv_example_ime_pinyin_1(void)
|
||||
{
|
||||
lv_obj_t * pinyin_ime = lv_ime_pinyin_create(lv_screen_active());
|
||||
lv_obj_set_style_text_font(pinyin_ime, &lv_font_simsun_16_cjk, 0);
|
||||
lv_obj_set_style_text_font(pinyin_ime, &lv_font_source_han_sans_sc_16_cjk, 0);
|
||||
//lv_ime_pinyin_set_dict(pinyin_ime, your_dict); // Use a custom dictionary. If it is not set, the built-in dictionary will be used.
|
||||
|
||||
/* ta1 */
|
||||
lv_obj_t * ta1 = lv_textarea_create(lv_screen_active());
|
||||
lv_textarea_set_one_line(ta1, true);
|
||||
lv_obj_set_style_text_font(ta1, &lv_font_simsun_16_cjk, 0);
|
||||
lv_obj_set_style_text_font(ta1, &lv_font_source_han_sans_sc_16_cjk, 0);
|
||||
lv_obj_align(ta1, LV_ALIGN_TOP_LEFT, 0, 0);
|
||||
|
||||
/*Create a keyboard and add it to ime_pinyin*/
|
||||
@@ -48,7 +48,7 @@ void lv_example_ime_pinyin_1(void)
|
||||
lv_obj_t * cz_label = lv_label_create(lv_screen_active());
|
||||
lv_label_set_text(cz_label,
|
||||
"嵌入式系统(Embedded System),\n是一种嵌入机械或电气系统内部、具有专一功能和实时计算性能的计算机系统。");
|
||||
lv_obj_set_style_text_font(cz_label, &lv_font_simsun_16_cjk, 0);
|
||||
lv_obj_set_style_text_font(cz_label, &lv_font_source_han_sans_sc_16_cjk, 0);
|
||||
lv_obj_set_width(cz_label, 310);
|
||||
lv_obj_align_to(cz_label, ta1, LV_ALIGN_OUT_BOTTOM_LEFT, 0, 0);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#include "../../lv_examples.h"
|
||||
#if LV_USE_LABEL && LV_USE_TEXTAREA && LV_FONT_SIMSUN_16_CJK && LV_USE_IME_PINYIN && LV_IME_PINYIN_USE_K9_MODE && LV_BUILD_EXAMPLES
|
||||
#if LV_USE_LABEL && LV_USE_TEXTAREA && LV_FONT_SOURCE_HAN_SANS_SC_16_CJK && LV_USE_IME_PINYIN && LV_IME_PINYIN_USE_K9_MODE && LV_BUILD_EXAMPLES
|
||||
|
||||
static void ta_event_cb(lv_event_t * e)
|
||||
{
|
||||
@@ -23,13 +23,13 @@ static void ta_event_cb(lv_event_t * e)
|
||||
void lv_example_ime_pinyin_2(void)
|
||||
{
|
||||
lv_obj_t * pinyin_ime = lv_ime_pinyin_create(lv_screen_active());
|
||||
lv_obj_set_style_text_font(pinyin_ime, &lv_font_simsun_16_cjk, 0);
|
||||
lv_obj_set_style_text_font(pinyin_ime, &lv_font_source_han_sans_sc_16_cjk, 0);
|
||||
//lv_ime_pinyin_set_dict(pinyin_ime, your_dict); // Use a custom dictionary. If it is not set, the built-in dictionary will be used.
|
||||
|
||||
/* ta1 */
|
||||
lv_obj_t * ta1 = lv_textarea_create(lv_screen_active());
|
||||
lv_textarea_set_one_line(ta1, true);
|
||||
lv_obj_set_style_text_font(ta1, &lv_font_simsun_16_cjk, 0);
|
||||
lv_obj_set_style_text_font(ta1, &lv_font_source_han_sans_sc_16_cjk, 0);
|
||||
lv_obj_align(ta1, LV_ALIGN_TOP_LEFT, 0, 0);
|
||||
|
||||
/*Create a keyboard and add it to ime_pinyin*/
|
||||
@@ -50,7 +50,7 @@ void lv_example_ime_pinyin_2(void)
|
||||
lv_obj_t * cz_label = lv_label_create(lv_screen_active());
|
||||
lv_label_set_text(cz_label,
|
||||
"嵌入式系统(Embedded System),\n是一种嵌入机械或电气系统内部、具有专一功能和实时计算性能的计算机系统。");
|
||||
lv_obj_set_style_text_font(cz_label, &lv_font_simsun_16_cjk, 0);
|
||||
lv_obj_set_style_text_font(cz_label, &lv_font_source_han_sans_sc_16_cjk, 0);
|
||||
lv_obj_set_width(cz_label, 310);
|
||||
lv_obj_align_to(cz_label, ta1, LV_ALIGN_OUT_BOTTOM_LEFT, 0, 0);
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ void lv_example_calendar_2(void)
|
||||
#endif
|
||||
|
||||
lv_calendar_set_chinese_mode(calendar, true);
|
||||
lv_obj_set_style_text_font(calendar, &lv_font_simsun_14_cjk, LV_PART_MAIN);
|
||||
lv_obj_set_style_text_font(calendar, &lv_font_source_han_sans_sc_14_cjk, LV_PART_MAIN);
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#include "../../lv_examples.h"
|
||||
#if LV_USE_LABEL && LV_BUILD_EXAMPLES && LV_FONT_DEJAVU_16_PERSIAN_HEBREW && LV_FONT_SIMSUN_16_CJK && LV_USE_BIDI
|
||||
#if LV_USE_LABEL && LV_BUILD_EXAMPLES && LV_FONT_DEJAVU_16_PERSIAN_HEBREW && LV_FONT_SOURCE_HAN_SANS_SC_16_CJK && LV_USE_BIDI
|
||||
|
||||
/**
|
||||
* Show mixed LTR, RTL and Chinese label
|
||||
@@ -23,7 +23,7 @@ void lv_example_label_3(void)
|
||||
lv_obj_t * cz_label = lv_label_create(lv_screen_active());
|
||||
lv_label_set_text(cz_label,
|
||||
"嵌入式系统(Embedded System),\n是一种嵌入机械或电气系统内部、具有专一功能和实时计算性能的计算机系统。");
|
||||
lv_obj_set_style_text_font(cz_label, &lv_font_simsun_16_cjk, 0);
|
||||
lv_obj_set_style_text_font(cz_label, &lv_font_source_han_sans_sc_16_cjk, 0);
|
||||
lv_obj_set_width(cz_label, 310);
|
||||
lv_obj_align(cz_label, LV_ALIGN_BOTTOM_LEFT, 5, -5);
|
||||
}
|
||||
|
||||
+6
-4
@@ -593,10 +593,12 @@
|
||||
#define LV_FONT_MONTSERRAT_48 0
|
||||
|
||||
/* Demonstrate special features */
|
||||
#define LV_FONT_MONTSERRAT_28_COMPRESSED 0 /**< bpp = 3 */
|
||||
#define LV_FONT_DEJAVU_16_PERSIAN_HEBREW 0 /**< Hebrew, Arabic, Persian letters and all their forms */
|
||||
#define LV_FONT_SIMSUN_14_CJK 0 /**< 1000 most common CJK radicals */
|
||||
#define LV_FONT_SIMSUN_16_CJK 0 /**< 1000 most common CJK radicals */
|
||||
#define LV_FONT_MONTSERRAT_28_COMPRESSED 0 /**< bpp = 3 */
|
||||
#define LV_FONT_DEJAVU_16_PERSIAN_HEBREW 0 /**< Hebrew, Arabic, Persian letters and all their forms */
|
||||
#define LV_FONT_SIMSUN_14_CJK 0 /**< 1000 most common CJK radicals */
|
||||
#define LV_FONT_SIMSUN_16_CJK 0 /**< 1000 most common CJK radicals */
|
||||
#define LV_FONT_SOURCE_HAN_SANS_SC_14_CJK 0 /**< 1000 most common CJK radicals */
|
||||
#define LV_FONT_SOURCE_HAN_SANS_SC_16_CJK 0 /**< 1000 most common CJK radicals */
|
||||
|
||||
/** Pixel perfect monospaced fonts */
|
||||
#define LV_FONT_UNSCII_8 0
|
||||
|
||||
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,96 @@
|
||||
Copyright 2014-2021 Adobe (http://www.adobe.com/), with Reserved Font
|
||||
Name 'Source'. Source is a trademark of Adobe in the United States
|
||||
and/or other countries.
|
||||
|
||||
This Font Software is licensed under the SIL Open Font License,
|
||||
Version 1.1.
|
||||
|
||||
This license is copied below, and is also available with a FAQ at:
|
||||
http://scripts.sil.org/OFL
|
||||
|
||||
-----------------------------------------------------------
|
||||
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
|
||||
-----------------------------------------------------------
|
||||
|
||||
PREAMBLE
|
||||
The goals of the Open Font License (OFL) are to stimulate worldwide
|
||||
development of collaborative font projects, to support the font
|
||||
creation efforts of academic and linguistic communities, and to
|
||||
provide a free and open framework in which fonts may be shared and
|
||||
improved in partnership with others.
|
||||
|
||||
The OFL allows the licensed fonts to be used, studied, modified and
|
||||
redistributed freely as long as they are not sold by themselves. The
|
||||
fonts, including any derivative works, can be bundled, embedded,
|
||||
redistributed and/or sold with any software provided that any reserved
|
||||
names are not used by derivative works. The fonts and derivatives,
|
||||
however, cannot be released under any other type of license. The
|
||||
requirement for fonts to remain under this license does not apply to
|
||||
any document created using the fonts or their derivatives.
|
||||
|
||||
DEFINITIONS
|
||||
"Font Software" refers to the set of files released by the Copyright
|
||||
Holder(s) under this license and clearly marked as such. This may
|
||||
include source files, build scripts and documentation.
|
||||
|
||||
"Reserved Font Name" refers to any names specified as such after the
|
||||
copyright statement(s).
|
||||
|
||||
"Original Version" refers to the collection of Font Software
|
||||
components as distributed by the Copyright Holder(s).
|
||||
|
||||
"Modified Version" refers to any derivative made by adding to,
|
||||
deleting, or substituting -- in part or in whole -- any of the
|
||||
components of the Original Version, by changing formats or by porting
|
||||
the Font Software to a new environment.
|
||||
|
||||
"Author" refers to any designer, engineer, programmer, technical
|
||||
writer or other person who contributed to the Font Software.
|
||||
|
||||
PERMISSION & CONDITIONS
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of the Font Software, to use, study, copy, merge, embed,
|
||||
modify, redistribute, and sell modified and unmodified copies of the
|
||||
Font Software, subject to the following conditions:
|
||||
|
||||
1) Neither the Font Software nor any of its individual components, in
|
||||
Original or Modified Versions, may be sold by itself.
|
||||
|
||||
2) Original or Modified Versions of the Font Software may be bundled,
|
||||
redistributed and/or sold with any software, provided that each copy
|
||||
contains the above copyright notice and this license. These can be
|
||||
included either as stand-alone text files, human-readable headers or
|
||||
in the appropriate machine-readable metadata fields within text or
|
||||
binary files as long as those fields can be easily viewed by the user.
|
||||
|
||||
3) No Modified Version of the Font Software may use the Reserved Font
|
||||
Name(s) unless explicit written permission is granted by the
|
||||
corresponding Copyright Holder. This restriction only applies to the
|
||||
primary font name as presented to the users.
|
||||
|
||||
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
|
||||
Software shall not be used to promote, endorse or advertise any
|
||||
Modified Version, except to acknowledge the contribution(s) of the
|
||||
Copyright Holder(s) and the Author(s) or with their explicit written
|
||||
permission.
|
||||
|
||||
5) The Font Software, modified or unmodified, in part or in whole,
|
||||
must be distributed entirely under this license, and must not be
|
||||
distributed under any other license. The requirement for fonts to
|
||||
remain under this license does not apply to any document created using
|
||||
the Font Software.
|
||||
|
||||
TERMINATION
|
||||
This license becomes null and void if any of the above conditions are
|
||||
not met.
|
||||
|
||||
DISCLAIMER
|
||||
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
|
||||
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
|
||||
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
|
||||
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
|
||||
OTHER DEALINGS IN THE FONT SOFTWARE.
|
||||
@@ -0,0 +1,275 @@
|
||||
<html>
|
||||
<meta charset="UTF-8" />
|
||||
<head>
|
||||
<title>Unscii - a bitmapped Unicode font for blocky graphics</title>
|
||||
<style>
|
||||
<!--
|
||||
@font-face{font-family:"unscii16";
|
||||
src: url("unscii-16.woff") format("woff"),
|
||||
url("unscii-16.ttf") format("ttf"); }
|
||||
@font-face{font-family:"unscii8";
|
||||
src: url("unscii-8.woff") format("woff"),
|
||||
url("unscii-8.ttf") format("ttf"); }
|
||||
a{color:#003;}
|
||||
ul{list-style-type:square;}
|
||||
h1{font-family:"unscii16",monospace;font-size:32px;text-align:center;}
|
||||
body{font-family:"unscii16",monospace; background-color:#ccc;color:#000;width:640px;}
|
||||
pre{font-family:"unscii16",monospace; font-size:16px;line-height:16px}
|
||||
-->
|
||||
</style>
|
||||
<body>
|
||||
|
||||
<p align="center"><img src="unsciilogo.png" alt="UNSCII" /></p>
|
||||
|
||||
<p>Unscii is a set of bitmapped Unicode fonts based on classic system fonts.
|
||||
Unscii attempts to support character cell art well while also being suitable
|
||||
for terminal and programming use.</p>
|
||||
|
||||
<p>The two main variants are unscii-8 (8×8 pixels per glyph) and unscii-16
|
||||
(8×16). There are also several alternative styles for unscii-8, as well as
|
||||
an 8x16 "full" variant that incorporates missing Unicode glyphs from
|
||||
Fixedsys Excelsior and GNU Unifont. "unscii-16-full" falls under GPL because
|
||||
of how Unifont is licensed; the other variants are in the Public Domain.</p>
|
||||
|
||||
<p>Unscii was created by Viznut.</p>
|
||||
|
||||
<br />
|
||||
|
||||
<h1>UNSCII 2.0</h1>
|
||||
|
||||
<p>In 2020-03-10, the new <a
|
||||
href="http://www.unicode.org/versions/Unicode13.0.0/">Unicode version
|
||||
13.0</a> added 214 graphics characters for "legacy computing" (including,
|
||||
among all, the missing PETSCII characters, and a majority of missing
|
||||
Teletext/Videotex characters). Most of these were already included in Unscii
|
||||
1.x, but now I have been able to give them proper Unicode mappings as well.
|
||||
This is the main reason for the Unscii 2.0 release.</p>
|
||||
|
||||
<p>Additionally, Unscii 2.0 fixes errors in some characters, legibility in
|
||||
some others and adds a bunch of new ones.</p>
|
||||
|
||||
<p>A test picture representing what is currently available in Unicode (feel
|
||||
free to copy-paste it to your editor to see what it looks like in other
|
||||
fonts):</p>
|
||||
|
||||
<pre>
|
||||
╎┆┊ ╱🭽▔🭾╲ 🮲🮳 🮸🮀🮵🮶🮀🮁🮁🮀🮼🯁🯂🯃 ▵ ↑ ◬
|
||||
╶─╴╺━╸ ═ ╎┆┊ ⎹ ⎸▣⎹ ⎸ ▝▛▀▜▘ 🯲🯷🯶 △ ▴ ╽ ◭⬘◮
|
||||
╷┌┬┐┍┯┑╒╤╕╏┇┋ 🮷 🭼▁🭿 ⎸ ▚▌█▐▞ 🯹🯵🯱 🯰 ▁▂▃▄▅▆▇█ ◃◅◁╳▷▻▹ ▲ ←╼╋╾→ ◩⬒⬔
|
||||
│├┼┤┝┿┥╞╪╡╏┇┋ ⎹╱ ╳ ╲⎸ ▗▙▄▟▖ 🯴🯳🯸 █🮆🮅🮄▀🮃🮂▔⎹ ▽ ◂◄◀🮽▶►▸╿ ⮝ ⬖◧◫◨⬗
|
||||
╵└┴┘┕┷┙╘╧╛┞╀┦ ▔▔▔▔▔ 🬑🬜🬰🬪🬟 🮞🮟 ▕▉ ◞◡◯◡ ◎🭵 ▿ ▼ ↓ ⮜◈⮞ ⬕⬓◪
|
||||
╻┎┰┒┏┳┓ ┭╆╈╅┮╍╍╌╌ 🬥🬦🬍🬲🬵🬹🬱🬷🬌🬓🬙 🮝🮜 🮇▊◝◠◯◉◯◡◟🭴 ▾ ⮟ ◕ ⬙ ◔
|
||||
┃┠╂┨┣╋┫ ╺┽╊◙╉┾┅┅┄┄ 🬔🬡🬖🬻🬞🬭🬏🬺🬢🬒🬧 🮈▋◍ ◠◯◠◜ 🭳 ◿◺
|
||||
╹┖┸┚┗┻┛ ━┵╄╇╃┶┉┉┈┈ 🬃🬤🬫🬴🬠🬋🬐🬸🬛🬗🬇 🭇🬼 ▐▌ ◌🮣🮢 🮦 🭲 ◹◸ 🭯 🮀⚞⚟🮀 🯊 ◙◛◶─◵
|
||||
╓╥╖ ╔╦╗┢╁┪ ┟┱┲┧ 🬣🬯🬈🬬🬁🬂🬀🬝🬅🬮🬘 🭢🭗 🮉▍ 🮤🮪🮫🮥🮧 🭱 🭯 🭮◙🭬╭──╮⎫🮻⎧ ◘◙│◲┼◱╭◒╮
|
||||
║╟╫╢🮐🮒🮐╠╬╣ ╹┃ ┡┹┺┩ 🬳🬉🬩🬕🬊🬎🬆🬨🬚🬄🬶 🭊🬿 🮊▎ 🮩🮬🮭🮨 🭰 ◢🭫◣ 🮚 │ ▢ ⎮🏎⎪ ◙◚◷┼◴│◑╋◐
|
||||
╙╨╜🮔 ╚╩╝ 🯆 🯅 🯇 🮣🮢 🯉 🯈 🭥🭚 🮋▏🮮 🮡🮠 ⎸🭮🭪◆🭨🮛🮿🭬╰─🮯─╯⎬⎯⎨ ◳─◰╰◓╯
|
||||
░░🮐🮑🮐▓▓██🮗🮗▤▤▥▥▦▦▩▩▧▧🮘🮘🮙🮙▨▨🮕🮕🮖🮖 🭋🭀 █▁🭻🭺🭹🭸🭷🭶▔ ◥🭩◤ 🭭 ⎮⯊⎪ ▱▰ ▭▬
|
||||
░░▒🮎▒▓▓██🮗🮗▤▤▥▥▦▦▩▩▧▧🮘🮘🮙🮙▨▨🮕🮕🮖🮖 🭦🭛 🮰 🭇🬼🭭 🭊🬿 🭋🭀 ⎭⯋⎩ ▯▮ ▫◻□■◼▪⬝·
|
||||
🮌█🮍 ╲╱ 🭇🬼🭈🬽🭉🬾◢◣🭇🭃🭎🬼🭈🭆🭂🭍🭑🬽🭉🭁🭌🬾🭈🭄🭏🬽🭅🭐 ◦○◯⬤◖◗ ⬫⬦⬨♢◊◇◆♦⬧⬥⬩⬪
|
||||
▒🮏▒ 🭢🭗🭣🭘🭤🭙◥◤🭢🭔🭟🭗🭣🭧🭓🭞🭜🭘🭤🭒🭝🭙🭣🭕🭠🭘🭖🭡 ∘⭘●
|
||||
🭢🭗 🭥🭚 🭦🭛 •
|
||||
</pre>
|
||||
|
||||
<h1>EXAMPLES</h1>
|
||||
|
||||
<p>Here are some conversions of legacy character set art into Unscii.</p>
|
||||
|
||||
<p>Amiga ansi: Divine Stylers by Hellbeard, as rendered with unscii-16.
|
||||
<a href="http://sixteencolors.net/pack/impure54/xz-dvn.ans">Source</a></p>
|
||||
|
||||
<img src="xz-dvn.png" />
|
||||
|
||||
<p>PC ansi: Ansi Love by Rad Man, as rendered with unscii-16.
|
||||
<a
|
||||
href="http://sixteencolors.net/pack/blocktronics_blockalypse/rad-LOVE.ANS">Source</a></p>
|
||||
|
||||
<img src="rad-love.png" />
|
||||
|
||||
<p>Commodore 64 petscii pictures as rendered with unscii-8, using the
|
||||
256-color xterm palette: I Has Floppy by Redcrab; The First Ball by
|
||||
Dr.TerrorZ; Gary by Mermaid.</p>
|
||||
<p align="center">
|
||||
<img src="ihasfloppy.png" />
|
||||
<img src="thefirstball.png" />
|
||||
<img src="gary.png" />
|
||||
</p>
|
||||
|
||||
<p>The source code package includes a generic bitmap-to-unscii converter. Here's an
|
||||
example of a conversion to unscii-8 using the 256-color xterm
|
||||
palette, without dithering:</p>
|
||||
<p align="center">
|
||||
<img src="tta.png" />
|
||||
</p>
|
||||
|
||||
<br />
|
||||
|
||||
<h1>DOWNLOADS</h1>
|
||||
|
||||
<p>HEX and PCF are the only actual bitmapped formats here. HEX is the same
|
||||
simple hexdump format as used by the Unifont project. TTF, OTF and WOFF
|
||||
are vectorized.</p>
|
||||
|
||||
<p>NOTE: Due to format limitations, the PCF versions lack all the characters
|
||||
above U+FFFF! However, all the new graphics characters are provided in the
|
||||
good old PUA range as well. A mapping is in the file <a
|
||||
href="uns2uni.tr">uns2uni.tr</a>.</p>
|
||||
|
||||
<table>
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
<img src="unscii16.png" alt="[Some Unscii16 glyphs]" />
|
||||
</td><td>
|
||||
<p>unscii-16: <a href="unscii-16.hex">hex</a> <a href="unscii-16.pcf">pcf</a> <a href="unscii-16.ttf">ttf</a> <a href="unscii-16.otf">otf</a> <a href="unscii-16.woff">woff</a><br />
|
||||
unscii-16-full: <a href="unscii-16-full.hex">hex</a> <a href="unscii-16-full.pcf">pcf</a> <a href="unscii-16-full.ttf">ttf</a> <a href="unscii-16-full.otf">otf</a> <a href="unscii-16-full.woff">woff</a><br />
|
||||
8x16. The latter is recommended for serious terminal use where a large
|
||||
Unicode coverage is needed. (Warning: unscii16-full files range from 2
|
||||
to 12 megabytes in size; the others range from 40 to 400 kilobytes.)</p>
|
||||
</td></tr>
|
||||
|
||||
<tr bgcolor="#999">
|
||||
<td>
|
||||
<img src="unscii8.png" alt="[Some Unscii8 glyphs]" />
|
||||
</td><td>
|
||||
<p>unscii-8: <a href="unscii-8.hex">hex</a> <a href="unscii-8.pcf">pcf</a> <a href="unscii-8.ttf">ttf</a> <a href="unscii-8.otf">otf</a> <a href="unscii-8.woff">woff</a></p>
|
||||
</td></tr>
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
<img src="unscii8-tall.png" alt="[Ascii range in Unscii8-tall" />
|
||||
</td><td>
|
||||
<p>unscii-8-tall: <a href="unscii-8-tall.hex">hex</a> <a href="unscii-8-tall.pcf">pcf</a> <a href="unscii-8-tall.ttf">ttf</a> <a href="unscii-8-tall.otf">otf</a> <a href="unscii-8-tall.woff">woff</a><br />
|
||||
Double-height version of unscii8.</p>
|
||||
</td></tr>
|
||||
|
||||
<tr bgcolor="#999">
|
||||
<td>
|
||||
<img src="unscii8-thin.png" alt="[Ascii range in Unscii8-tall" />
|
||||
</td><td>
|
||||
<p>unscii-8-thin: <a href="unscii-8-thin.hex">hex</a> <a href="unscii-8-thin.pcf">pcf</a> <a href="unscii-8-thin.ttf">ttf</a> <a href="unscii-8-thin.otf">otf</a> <a href="unscii-8-thin.woff">woff</a><br />
|
||||
Based on system fonts with 1-pixel-wide lines.</p>
|
||||
</td></tr>
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
<img src="unscii8-alt.png" alt="[Ascii range in Unscii8-alt" />
|
||||
</td><td>
|
||||
<p>unscii-8-alt: <a href="unscii-8-alt.hex">hex</a> <a href="unscii-8-alt.pcf">pcf</a> <a href="unscii-8-alt.ttf">ttf</a> <a href="unscii-8-alt.otf">otf</a> <a href="unscii-8-alt.woff">woff</a><br />
|
||||
Based on the more peculiar glyph forms of the reference fonts.</p>
|
||||
</td></tr>
|
||||
|
||||
<tr bgcolor="#999">
|
||||
<td>
|
||||
<img src="unscii8-mcr.png" alt="[Ascii range in Unscii8-alt" />
|
||||
</td><td>
|
||||
<p>unscii-8-mcr: <a href="unscii-8-mcr.hex">hex</a> <a href="unscii-8-mcr.pcf">pcf</a> <a href="unscii-8-mcr.ttf">ttf</a> <a href="unscii-8-mcr.otf">otf</a> <a href="unscii-8-mcr.woff">woff</a><br />
|
||||
Based on retrofuturistic MCR-like 8×8 fonts used in various games, demos,
|
||||
etc.</p>
|
||||
</td></tr>
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
<img src="unscii8-fantasy.png" alt="[Ascii range in Unscii8-alt" />
|
||||
</td><td>
|
||||
<p>unscii-8-fantasy: <a href="unscii-8-fantasy.hex">hex</a> <a href="unscii-8-fantasy.pcf">pcf</a> <a href="unscii-8-fantasy.ttf">ttf</a> <a href="unscii-8-fantasy.otf">otf</a> <a href="unscii-8-fantasy.woff">woff</a><br />
|
||||
Based on fonts used in fantasy games.</p>
|
||||
</td></tr>
|
||||
|
||||
<tr bgcolor="#999">
|
||||
<td>
|
||||
|
||||
</td><td>
|
||||
<p><a href="unscii-2.1-src.tar.gz">Source code for current Unscii version (2.1)</a></p>
|
||||
<p><a href="unscii-2.0-src.tar.gz">Source code for Unscii 2.0</a></p>
|
||||
<p><a href="unscii-1.1-src.tar.gz">Source code for Unscii 1.1</a></p>
|
||||
</td></tr>
|
||||
|
||||
</table>
|
||||
|
||||
<br />
|
||||
|
||||
<h1>BACKSTORY</h1>
|
||||
|
||||
<p>Years ago, I noticed that Unicode had a bunch of pseudographic characters
|
||||
that could be used to enrichen Ansi art. However, no one seemed to use them.
|
||||
Even MUDs that used the 256-color Xterm palette and had no issues with
|
||||
Unicode still preferred to stick to the blocks available in the MS-DOS
|
||||
codepage 437.</p>
|
||||
|
||||
<p>After looking into existing Unicode fonts, the reason became obvious: the
|
||||
implementation of non-CP437 graphics characters was shaky at best. Unicode
|
||||
Consortium doesn't even care how pseudographics are implemented. It was a
|
||||
kind of chicken-and-egg problem: No commonly accepted Unicode graphics font,
|
||||
no Unicode art scene; no art scene, no font support. The idea of an
|
||||
art-compatible Unicode font was born.</p>
|
||||
|
||||
<p>For Unscii, I studied a bunch of classic system fonts and how their
|
||||
characters had been used in Ascii and "extended-Ascii" art.</p>
|
||||
|
||||
<p>8×8 system fonts can be divided in two major categories according to
|
||||
their line thickness: 1-pixel and 2-pixel. 2-pixel-wide lines are used in
|
||||
more prominent classic systems, so I chose it. Also, 2-pixel 8×8 system
|
||||
fonts are surprisingly similar to one another which made it easier to choose
|
||||
neutral shapes.</p>
|
||||
|
||||
<p>The basic look of the 8×8 variant of Unscii is based on the following
|
||||
systems:</p>
|
||||
<ul>
|
||||
<li>Amiga (Topaz-8)</li>
|
||||
<li>Amstrad CPC</li>
|
||||
<li>Atari 8-bit (as in 800, XL etc.)</li>
|
||||
<li>Atari Arcade (the iconic ROM font)</li>
|
||||
<li>Atari 32-bit (as in ST etc.)</li>
|
||||
<li>BBC Micro (graphics mode font)</li>
|
||||
<li>Commodore 64</li>
|
||||
<li>IBM PC (the 8×8 ROM font as in CGA, or VGA 80×50)</li>
|
||||
</ul>
|
||||
|
||||
<p>The 8×16 variant of Unscii has been mostly derived from the 8×8 variant
|
||||
by using a set of transformation principles. When in doubt, the following
|
||||
fonts have been looked at for additional reference:</p>
|
||||
<ul>
|
||||
<li>Windows Fixedsys 8×15 (and its modern successor Fixedsys Excelsior)</li>
|
||||
<li>IBM PC VGA ROM font(s) (and their modern successor U_VGA)</li>
|
||||
<li>X Window System fonts 8x13(B) and 9x15(B)</li>
|
||||
<li>Classic Macintosh 12-point Monaco</li>
|
||||
<li>Digital VT420 10×16 font (used in the 80×24 mode)</li>
|
||||
<li>Modern monospaced vector fonts: DejaVu Sans Mono, Lucida Console,
|
||||
Inconsolata</li>
|
||||
</ul>
|
||||
|
||||
<p>In general, neutral shapes are preferred, unless art, legibility or
|
||||
readability require otherwise: The characters /\XY are connective because of
|
||||
their connetive use in ascii art, and the serifs in iIl are longer than in
|
||||
most classic systems.</p>
|
||||
|
||||
<p>Whenever a 8×16 shape has not been defined, Unscii falls back to
|
||||
height-doubled 8×8.</p>
|
||||
|
||||
<p>I also studied game fonts and thin-line system fonts. This resulted in
|
||||
the variants unscii-8-thin, unscii-8-mcr and unscii-8-fantasy.</p>
|
||||
|
||||
<p>When studying legacy character sets, I found literally hundreds of
|
||||
characters without proper Unicode codepoints. These are mapped in the PUA
|
||||
range as follows:</p>
|
||||
|
||||
<ul>
|
||||
<li>U+E080..E0FF: Teletext/Videotex block mosaics.</li>
|
||||
<li>U+E100..: The most prominent and useful non-Unicode pseudographics:
|
||||
everything found in PETSCII, Videotex smooth mosaics, extra shades,
|
||||
round corners, X/Y doublers.</li>
|
||||
<li>U+E800..: Somewhat stranger but still potentially useful: junctions with
|
||||
border-aligned lines, diagonal line junctions, non-straight lines, weirder
|
||||
fill patterns, etc.</li>
|
||||
<li>U+EC00..: Total oddities. Mostly game-oriented bitmaps and other
|
||||
depictive characters from Sharp MZ, Aquarius, etc.</li>
|
||||
</ul>
|
||||
|
||||
<p>Since Unicode 13.0, many of these are also available in Unicode, but
|
||||
the PUA mappings are retained for compatibility.</p>
|
||||
|
||||
<br />
|
||||
|
||||
</body>
|
||||
</html>
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,105 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import argparse
|
||||
from typing import List, Tuple
|
||||
import sys
|
||||
import os
|
||||
|
||||
try:
|
||||
from fontTools.ttLib import TTFont
|
||||
except ImportError:
|
||||
print("Need fonttools package, do `pip3 install fonttools`")
|
||||
sys.exit(1)
|
||||
|
||||
# Fonts that are excluded from the license check
|
||||
# Only add fonts that are known to be public domain or have a compatible license
|
||||
_EXCLUDED_FONTS = {}
|
||||
|
||||
# Font name mapping to remove any style suffix
|
||||
_FONT_NAME_MAP = {
|
||||
"Montserrat Medium": "Montserrat",
|
||||
"Montserrat SemiBold": "Montserrat",
|
||||
"Montserrat Bold": "Montserrat",
|
||||
"Source Han Sans SC Normal": "Source Han Sans SC",
|
||||
}
|
||||
|
||||
|
||||
def get_font_full_name(font_path: str) -> str:
|
||||
font = TTFont(font_path)
|
||||
name_records = font["name"].names
|
||||
for record in name_records:
|
||||
if record.nameID == 4: # ID 4 corresponds to the full font name
|
||||
return record.toStr()
|
||||
return None
|
||||
|
||||
|
||||
def list_intree_fonts(path: str) -> List[Tuple[str, str]]:
|
||||
fonts = []
|
||||
for root, _, files in os.walk(path):
|
||||
for file in files:
|
||||
if file.lower().endswith((".ttf", ".otf", ".woff", ".woff2")):
|
||||
font_path = os.path.join(root, file)
|
||||
font_name = get_font_full_name(font_path).strip()
|
||||
if font_name:
|
||||
# Add a no-strict mode to ignore missing license files
|
||||
fonts.append((font_path, font_name))
|
||||
return fonts
|
||||
|
||||
|
||||
def has_intree_license(license_root_folder: str, font_name: str) -> bool:
|
||||
if font_name in _EXCLUDED_FONTS:
|
||||
return True
|
||||
|
||||
# Prepare candidate folder names, ignoring casing
|
||||
candidates = {
|
||||
font_name.lower(),
|
||||
font_name.replace(" ", "_").lower(),
|
||||
font_name.replace(" ", "").lower(),
|
||||
}
|
||||
|
||||
if font_name in _FONT_NAME_MAP:
|
||||
candidates.add(_FONT_NAME_MAP[font_name].lower())
|
||||
candidates.add(_FONT_NAME_MAP[font_name].replace(" ", "_").lower())
|
||||
candidates.add(_FONT_NAME_MAP[font_name].replace(" ", "").lower())
|
||||
|
||||
# List all directories in the license_root_folder
|
||||
for entry in os.listdir(license_root_folder):
|
||||
entry_path = os.path.join(license_root_folder, entry)
|
||||
if os.path.isdir(entry_path):
|
||||
# Compare the directory name in lowercase with candidates
|
||||
if entry.lower() in candidates:
|
||||
# Check if the directory contains at least one file (ignoring subdirectories)
|
||||
for item in os.listdir(entry_path):
|
||||
item_path = os.path.join(entry_path, item)
|
||||
if os.path.isfile(item_path):
|
||||
return True
|
||||
return False
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
parser = argparse.ArgumentParser(description="Verify font licenses")
|
||||
parser.add_argument(
|
||||
"--no-strict",
|
||||
action="store_true",
|
||||
help="Ignore missing license files",
|
||||
default=False,
|
||||
)
|
||||
args = parser.parse_args()
|
||||
|
||||
SCRIPT_DIR = os.path.dirname(__file__)
|
||||
# List of font files in the tree
|
||||
fonts = list_intree_fonts(os.path.join(SCRIPT_DIR, ".."))
|
||||
has_font_without_license = False
|
||||
|
||||
print("Verifying license for fonts:")
|
||||
for path, name in fonts:
|
||||
if has_intree_license(
|
||||
os.path.join(SCRIPT_DIR, "built_in_font", "font_license"), name
|
||||
):
|
||||
print(f" [OK] '{name}'")
|
||||
else:
|
||||
print(f" [MISSING] '{name}' - {path}")
|
||||
has_font_without_license = True
|
||||
|
||||
if has_font_without_license and not args.no_strict:
|
||||
sys.exit(1)
|
||||
@@ -304,13 +304,25 @@ LV_FONT_DECLARE(lv_font_dejavu_16_persian_hebrew)
|
||||
#endif
|
||||
|
||||
#if LV_FONT_SIMSUN_14_CJK
|
||||
#warning "LV_FONT_SIMSUN_14_CJK is deprecated, use LV_FONT_SOURCE_HAN_SANS_SC_14_CJK instead."
|
||||
|
||||
LV_FONT_DECLARE(lv_font_simsun_14_cjk)
|
||||
#endif
|
||||
|
||||
#if LV_FONT_SIMSUN_16_CJK
|
||||
#warning "LV_FONT_SIMSUN_16_CJK is deprecated, use LV_FONT_SOURCE_HAN_SANS_SC_16_CJK instead."
|
||||
|
||||
LV_FONT_DECLARE(lv_font_simsun_16_cjk)
|
||||
#endif
|
||||
|
||||
#if LV_FONT_SOURCE_HAN_SANS_SC_14_CJK
|
||||
LV_FONT_DECLARE(lv_font_source_han_sans_sc_14_cjk)
|
||||
#endif
|
||||
|
||||
#if LV_FONT_SOURCE_HAN_SANS_SC_16_CJK
|
||||
LV_FONT_DECLARE(lv_font_source_han_sans_sc_16_cjk)
|
||||
#endif
|
||||
|
||||
#if LV_FONT_UNSCII_8
|
||||
LV_FONT_DECLARE(lv_font_unscii_8)
|
||||
#endif
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+18
-4
@@ -1766,28 +1766,42 @@
|
||||
#ifdef CONFIG_LV_FONT_MONTSERRAT_28_COMPRESSED
|
||||
#define LV_FONT_MONTSERRAT_28_COMPRESSED CONFIG_LV_FONT_MONTSERRAT_28_COMPRESSED
|
||||
#else
|
||||
#define LV_FONT_MONTSERRAT_28_COMPRESSED 0 /**< bpp = 3 */
|
||||
#define LV_FONT_MONTSERRAT_28_COMPRESSED 0 /**< bpp = 3 */
|
||||
#endif
|
||||
#endif
|
||||
#ifndef LV_FONT_DEJAVU_16_PERSIAN_HEBREW
|
||||
#ifdef CONFIG_LV_FONT_DEJAVU_16_PERSIAN_HEBREW
|
||||
#define LV_FONT_DEJAVU_16_PERSIAN_HEBREW CONFIG_LV_FONT_DEJAVU_16_PERSIAN_HEBREW
|
||||
#else
|
||||
#define LV_FONT_DEJAVU_16_PERSIAN_HEBREW 0 /**< Hebrew, Arabic, Persian letters and all their forms */
|
||||
#define LV_FONT_DEJAVU_16_PERSIAN_HEBREW 0 /**< Hebrew, Arabic, Persian letters and all their forms */
|
||||
#endif
|
||||
#endif
|
||||
#ifndef LV_FONT_SIMSUN_14_CJK
|
||||
#ifdef CONFIG_LV_FONT_SIMSUN_14_CJK
|
||||
#define LV_FONT_SIMSUN_14_CJK CONFIG_LV_FONT_SIMSUN_14_CJK
|
||||
#else
|
||||
#define LV_FONT_SIMSUN_14_CJK 0 /**< 1000 most common CJK radicals */
|
||||
#define LV_FONT_SIMSUN_14_CJK 0 /**< 1000 most common CJK radicals */
|
||||
#endif
|
||||
#endif
|
||||
#ifndef LV_FONT_SIMSUN_16_CJK
|
||||
#ifdef CONFIG_LV_FONT_SIMSUN_16_CJK
|
||||
#define LV_FONT_SIMSUN_16_CJK CONFIG_LV_FONT_SIMSUN_16_CJK
|
||||
#else
|
||||
#define LV_FONT_SIMSUN_16_CJK 0 /**< 1000 most common CJK radicals */
|
||||
#define LV_FONT_SIMSUN_16_CJK 0 /**< 1000 most common CJK radicals */
|
||||
#endif
|
||||
#endif
|
||||
#ifndef LV_FONT_SOURCE_HAN_SANS_SC_14_CJK
|
||||
#ifdef CONFIG_LV_FONT_SOURCE_HAN_SANS_SC_14_CJK
|
||||
#define LV_FONT_SOURCE_HAN_SANS_SC_14_CJK CONFIG_LV_FONT_SOURCE_HAN_SANS_SC_14_CJK
|
||||
#else
|
||||
#define LV_FONT_SOURCE_HAN_SANS_SC_14_CJK 0 /**< 1000 most common CJK radicals */
|
||||
#endif
|
||||
#endif
|
||||
#ifndef LV_FONT_SOURCE_HAN_SANS_SC_16_CJK
|
||||
#ifdef CONFIG_LV_FONT_SOURCE_HAN_SANS_SC_16_CJK
|
||||
#define LV_FONT_SOURCE_HAN_SANS_SC_16_CJK CONFIG_LV_FONT_SOURCE_HAN_SANS_SC_16_CJK
|
||||
#else
|
||||
#define LV_FONT_SOURCE_HAN_SANS_SC_16_CJK 0 /**< 1000 most common CJK radicals */
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
@@ -228,10 +228,10 @@ extern "C" {
|
||||
# define CONFIG_LV_FONT_DEFAULT &lv_font_montserrat_28_compressed
|
||||
#elif defined(CONFIG_LV_FONT_DEFAULT_DEJAVU_16_PERSIAN_HEBREW)
|
||||
# define CONFIG_LV_FONT_DEFAULT &lv_font_dejavu_16_persian_hebrew
|
||||
#elif defined(CONFIG_LV_FONT_DEFAULT_SIMSUN_14_CJK)
|
||||
# define CONFIG_LV_FONT_DEFAULT &lv_font_simsun_14_cjk
|
||||
#elif defined(CONFIG_LV_FONT_DEFAULT_SIMSUN_16_CJK)
|
||||
# define CONFIG_LV_FONT_DEFAULT &lv_font_simsun_16_cjk
|
||||
#elif defined(CONFIG_LV_FONT_SOURCE_HAN_SANS_SC_14_CJK)
|
||||
# define CONFIG_LV_FONT_DEFAULT &lv_font_source_han_sans_sc_14_cjk
|
||||
#elif defined(CONFIG_LV_FONT_SOURCE_HAN_SANS_SC_16_CJK)
|
||||
# define CONFIG_LV_FONT_DEFAULT &lv_font_source_han_sans_sc_16_cjk
|
||||
#elif defined(CONFIG_LV_FONT_DEFAULT_UNSCII_8)
|
||||
# define CONFIG_LV_FONT_DEFAULT &lv_font_unscii_8
|
||||
#elif defined(CONFIG_LV_FONT_DEFAULT_UNSCII_16)
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 21 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 20 KiB |
@@ -38,8 +38,8 @@
|
||||
#define LV_FONT_MONTSERRAT_48 1
|
||||
#define LV_FONT_MONTSERRAT_28_COMPRESSED 1
|
||||
#define LV_FONT_DEJAVU_16_PERSIAN_HEBREW 1
|
||||
#define LV_FONT_SIMSUN_14_CJK 1
|
||||
#define LV_FONT_SIMSUN_16_CJK 1
|
||||
#define LV_FONT_SOURCE_HAN_SANS_SC_14_CJK 1
|
||||
#define LV_FONT_SOURCE_HAN_SANS_SC_16_CJK 1
|
||||
#define LV_FONT_UNSCII_8 1
|
||||
#define LV_FONT_UNSCII_16 1
|
||||
#define LV_FONT_DEFAULT &lv_font_montserrat_14
|
||||
|
||||
@@ -228,7 +228,7 @@ void test_calendar_chinese_calendar(void)
|
||||
lv_calendar_set_today_date(g_calendar, 2024, 03, 22);
|
||||
lv_calendar_set_month_shown(g_calendar, 2024, 03);
|
||||
|
||||
lv_obj_set_style_text_font(g_calendar, &lv_font_simsun_14_cjk, LV_PART_MAIN);
|
||||
lv_obj_set_style_text_font(g_calendar, &lv_font_source_han_sans_sc_14_cjk, LV_PART_MAIN);
|
||||
lv_calendar_set_chinese_mode(g_calendar, true);
|
||||
|
||||
TEST_ASSERT_EQUAL_SCREENSHOT("widgets/calendar_09.png");
|
||||
|
||||
Reference in New Issue
Block a user