1
0
forked from me/IronOS

Impl. CJK support with zh-TW and yue-HK translations

Also add support for generating font table using the WenQuanYi Bitmap
Song font.
This commit is contained in:
Alvin Wong
2021-01-22 18:18:32 +08:00
parent 1a8826c0a8
commit 47692024c5
15 changed files with 548820 additions and 17 deletions

View File

@@ -11,8 +11,10 @@ RUN apt-get update && \
bzip2 \
git \
python3 \
python3-pip \
wget && \
apt-get clean
RUN python3 -m pip install bdflib
RUN wget -qO- https://armkeil.blob.core.windows.net/developer/Files/downloads/gnu-rm/9-2020q2/gcc-arm-none-eabi-9-2020-q2-update-x86_64-linux.tar.bz2 | tar -xj
RUN wget -qO- https://github.com/Ralim/nuclei-compiler/releases/download/2020.08/nuclei_riscv_newlibc_prebuilt_linux64_2020.08.tar.bz2 | tar -xj

11
Translations/README.md Normal file
View File

@@ -0,0 +1,11 @@
### CJK Notes
Unlike Latin and Cyrillic scripts, CJK Unified Ideographs cannot be legibly
displayed using the small font, which is only 6x8px in size. Therefore, Hanzi,
Kanji and Hanja can only be displayed using the 12x16px large font.
By default, menu items are shown using two lines of text with the small font.
When translating such items for CJK, leave the first line empty and put the
translated text on the second line. This way, the firmware will automatically
know to display the text using the large font. This also applies to the
`SettingsResetMessage` text -- just start the message with `\n`.

View File

@@ -10,6 +10,7 @@ import sys
import fontTables
import re
import subprocess
from bdflib import reader as bdfreader
HERE = os.path.dirname(__file__)
@@ -19,6 +20,10 @@ except NameError:
to_unicode = str
with open(os.path.join(HERE, "wqy-bitmapsong/wenquanyi_9pt.bdf"), "rb") as handle:
cjkFont = bdfreader.read_bdf(handle)
def log(message):
print(message, file=sys.stdout)
@@ -176,6 +181,49 @@ def getLetterCounts(defs, lang):
symbolCounts.reverse()
return symbolCounts
def getCJKGlyph(sym):
from bdflib.model import Glyph
try:
glyph: Glyph = cjkFont[ord(sym)]
except:
return None
data = glyph.data
(srcLeft, srcBottom, srcW, srcH) = glyph.get_bounding_box()
dstW = 12
dstH = 16
# The source data is a per-row list of ints. The first item is the bottom-
# most row. For each row, the LSB is the right-most pixel.
# Here, (x, y) is the coordinates with origin at the top-left.
def getCell(x, y):
# Adjust x coordinates by actual bounding box.
adjX = x - srcLeft
if adjX < 0 or adjX >= srcW:
return False
# Adjust y coordinates by actual bounding box, then place the glyph
# baseline 3px above the bottom edge to make it centre-ish.
# This metric is optimized for WenQuanYi Bitmap Song 9pt and assumes
# each glyph is to be placed in a 12x12px box.
adjY = y - (dstH - srcH - srcBottom - 3)
if adjY < 0 or adjY >= srcH:
return False
if data[srcH - adjY - 1] & (1 << (srcW - adjX - 1)):
return True
else:
return False
# A glyph in the font table is divided into upper and lower parts, each by
# 8px high. Each byte represents half if a column, with the LSB being the
# top-most pixel. The data goes from the left-most to the right-most column
# of the top half, then from the left-most to the right-most column of the
# bottom half.
s = ""
for block in range(2):
for c in range(dstW):
b = 0
for r in range(8):
if getCell(c, r + 8 * block):
b |= 0x01 << r
s += f"0x{b:02X},"
return s
def getFontMapAndTable(textList):
# the text list is sorted
@@ -188,10 +236,13 @@ def getFontMapAndTable(textList):
for sym in forcedFirstSymbols:
symbolMap[sym] = "\\x%0.2X" % index
index = index + 1
if len(textList) > (253 - len(forcedFirstSymbols)):
log("Error, too many used symbols for this version")
totalSymbolCount = len(set(textList) | set(forcedFirstSymbols))
# \x00 is for NULL termination and \x01 is for newline, so the maximum
# number of symbols allowed with 8 bits is `256 - 2`.
if totalSymbolCount > (256 - 2):
log(f"Error, too many used symbols for this version (total {totalSymbolCount})")
exit(1)
log("Generating fonts for {} symbols".format(len(textList)))
log("Generating fonts for {} symbols".format(totalSymbolCount))
for sym in textList:
if sym not in symbolMap:
@@ -218,8 +269,16 @@ def getFontMapAndTable(textList):
for sym in textList:
if sym not in fontTable:
log("Missing Large font element for {}".format(sym))
exit(1)
# Assume this is a CJK character.
fromFont = getCJKGlyph(sym)
if fromFont is None:
log("Missing Large font element for {}".format(sym))
exit(1)
# We store the glyph back to the fontTable.
fontTable[sym] = fromFont
# We also put a "replacement character" in the small font table
# for sanity. (It is a question mark with inverted colour.)
fontSmallTable[sym] = "0xFD, 0xFE, 0xAE, 0xF6, 0xF9, 0xFF,"
if sym not in forcedFirstSymbols:
fontLine = fontTable[sym]
fontTableStrings.append(fontLine + "//{} -> {}".format(symbolMap[sym], sym))

View File

@@ -0,0 +1,280 @@
{
"languageCode": "YUE_HK",
"languageLocalName": "廣東話 (香港)",
"cyrillicGlyphs": false,
"tempUnitFahrenheit": true,
"messages": {
"SettingsCalibrationDone": "校正完成!",
"SettingsCalibrationWarning": "開始温度校正之前,請先確定辣雞咀係處於室温!",
"SettingsResetWarning": "你係咪確定要將全部設定重設到預設值?",
"UVLOWarningString": "電壓過低",
"UndervoltageString": "Undervoltage",
"InputVoltageString": "Input V: ",
"WarningTipTempString": "Tip temp: ",
"BadTipString": "BAD TIP",
"SleepingSimpleString": "Zzzz",
"SleepingAdvancedString": "Sleeping...",
"WarningSimpleString": "HOT!",
"WarningAdvancedString": "!!! HOT TIP !!!",
"SleepingTipAdvancedString": "Tip:",
"IdleTipString": "Tip:",
"IdleSetString": " Set:",
"TipDisconnectedString": "NO TIP",
"SolderingAdvancedPowerPrompt": "Power: ",
"OffString": "關",
"ResetOKMessage": "已重設!",
"YourGainMessage": "Your gain:",
"SettingsResetMessage": "\n設定已被重設",
"NoAccelerometerMessage": "No accelerometer\ndetected!",
"NoPowerDeliveryMessage": "No USB-PD IC\ndetected!",
"LockingKeysString": "已鎖定",
"UnlockingKeysString": "已解除鎖定",
"WarningKeysLockedString": "!撳掣鎖定!"
},
"characters": {
"SettingRightChar": "右",
"SettingLeftChar": "左",
"SettingAutoChar": "自",
"SettingFastChar": "快",
"SettingSlowChar": "慢",
"SettingStartSolderingChar": "焊",
"SettingStartSleepChar": "待",
"SettingStartSleepOffChar": "室",
"SettingStartNoneChar": "無",
"SettingSensitivityOff": "關",
"SettingSensitivityLow": "低",
"SettingSensitivityMedium": "中",
"SettingSensitivityHigh": "高",
"SettingLockDisableChar": "無",
"SettingLockBoostChar": "增",
"SettingLockFullChar": "全"
},
"menuGroups": {
"SolderingMenu": {
"text2": [
"",
"焊接設定"
],
"desc": "焊接設定"
},
"PowerSavingMenu": {
"text2": [
"",
"待機設定"
],
"desc": "自動待機慳電設定"
},
"UIMenu": {
"text2": [
"",
"使用者介面"
],
"desc": "使用者介面設定"
},
"AdvancedMenu": {
"text2": [
"",
"進階設定"
],
"desc": "進階設定"
}
},
"menuOptions": {
"DCInCutoff": {
"text2": [
"",
"電源"
],
"desc": "輸入電源;設定自動停機電壓 <DC 10V> <S 鋰電池以每粒3.3V計算;依個設定會停用功率限制>"
},
"SleepTemperature": {
"text2": [
"",
"待機温度"
],
"desc": "喺待機模式時嘅辣雞咀温度"
},
"SleepTimeout": {
"text2": [
"",
"待機延時"
],
"desc": "自動進入待機模式前嘅閒置等候時間 <S=秒 | M=分鐘>"
},
"ShutdownTimeout": {
"text2": [
"",
"自動熄機"
],
"desc": "自動熄機前嘅閒置等候時間 <M=分鐘>"
},
"MotionSensitivity": {
"text2": [
"",
"動作敏感度"
],
"desc": "0=停用 | 1=最低敏感度 | ... | 9=最高敏感度"
},
"TemperatureUnit": {
"text2": [
"",
"温度單位"
],
"desc": "C=攝氏 | F=華氏"
},
"AdvancedIdle": {
"text2": [
"",
"詳細閒置畫面"
],
"desc": "喺閒置畫面以英文細字顯示詳細嘅資料"
},
"DisplayRotation": {
"text2": [
"",
"畫面方向"
],
"desc": "A=自動 | L=使用左手 | R=使用右手"
},
"BoostTemperature": {
"text2": [
"",
"增熱温度"
],
"desc": "喺增熱模式時使用嘅温度"
},
"AutoStart": {
"text2": [
"",
"自動啓用"
],
"desc": "開機時自動啓用 <無=停用 | 焊=焊接模式 | 待=待機模式 | 室=室温待機>"
},
"CooldownBlink": {
"text2": [
"",
"降温時閃爍"
],
"desc": "停止加熱之後,當辣雞咀仲係熱嗰陣閃爍畫面"
},
"TemperatureCalibration": {
"text2": [
"",
"温度校正?"
],
"desc": "開始校正辣雞咀温度位移"
},
"SettingsReset": {
"text2": [
"",
"全部重設?"
],
"desc": "將所有設定重設到預設值"
},
"VoltageCalibration": {
"text2": [
"",
"輸入電壓校正?"
],
"desc": "開始校正VIN輸入電壓 <長撳以退出>"
},
"AdvancedSoldering": {
"text2": [
"",
"詳細焊接畫面"
],
"desc": "喺焊接模式畫面以英文細字顯示詳細嘅資料"
},
"ScrollingSpeed": {
"text2": [
"",
"捲動速度"
],
"desc": "解說文字嘅捲動速度"
},
"TipModel": {
"text2": [
"Tip",
"model"
],
"desc": "Tip model selection"
},
"SimpleCalibrationMode": {
"text2": [
"Simple",
"calibration"
],
"desc": "Using hot water to calibrate tip"
},
"AdvancedCalibrationMode": {
"text2": [
"Advanced",
"calibration"
],
"desc": "Using a thermocouple on the tip to calibrate it"
},
"QCMaxVoltage": {
"text2": [
"",
"QC電壓"
],
"desc": "使用QC電源時請求嘅最高目標電壓"
},
"PowerLimit": {
"text2": [
"",
"功率限制"
],
"desc": "限制辣雞可用嘅最大功率 <W=watt>"
},
"ReverseButtonTempChange": {
"text2": [
"",
"反轉加減掣"
],
"desc": "反轉調校温度時加減掣嘅方向"
},
"TempChangeShortStep": {
"text2": [
"",
"温度調整 短"
],
"desc": "調校温度時短撳一下嘅温度變幅"
},
"TempChangeLongStep": {
"text2": [
"",
"温度調整 長"
],
"desc": "調校温度時長撳嘅温度變幅"
},
"PowerPulsePower": {
"text2": [
"",
"電源脈衝"
],
"desc": "為保持電源喚醒而通電所用嘅功率 <watt>"
},
"TipGain": {
"text2": [
"",
"温度增幅"
],
"desc": "辣雞咀温度增幅"
},
"HallEffSensitivity": {
"text2": [
"",
"磁場敏感度"
],
"desc": "磁場感應器用嚟啓動待機模式嘅敏感度 <關=停用 | 低=最低敏感度 | 中=中等敏感度 | 高=最高敏感度>"
},
"LockingMode": {
"text2": [
"",
"撳掣鎖定"
],
"desc": "喺焊接模式時,同時長撳兩粒掣啓用撳掣鎖定 <無=停用 | 增=只鎖定增熱模式 | 全=鎖定全部>"
}
}
}

View File

@@ -0,0 +1,280 @@
{
"languageCode": "ZH_TW",
"languageLocalName": "正體中文",
"cyrillicGlyphs": false,
"tempUnitFahrenheit": true,
"messages": {
"SettingsCalibrationDone": "校正完成!",
"SettingsCalibrationWarning": "開始溫度校正前,請先確定鉻鐵頭正處於室溫!",
"SettingsResetWarning": "你是否確定要將全部設定重設到預設值?",
"UVLOWarningString": "電壓過低",
"UndervoltageString": "Undervoltage",
"InputVoltageString": "Input V: ",
"WarningTipTempString": "Tip temp: ",
"BadTipString": "BAD TIP",
"SleepingSimpleString": "Zzzz",
"SleepingAdvancedString": "Sleeping...",
"WarningSimpleString": "HOT!",
"WarningAdvancedString": "!!! HOT TIP !!!",
"SleepingTipAdvancedString": "Tip:",
"IdleTipString": "Tip:",
"IdleSetString": " Set:",
"TipDisconnectedString": "NO TIP",
"SolderingAdvancedPowerPrompt": "Power: ",
"OffString": "關",
"ResetOKMessage": "已重設!",
"YourGainMessage": "Your gain:",
"SettingsResetMessage": "\n設定已被重設",
"NoAccelerometerMessage": "No accelerometer\ndetected!",
"NoPowerDeliveryMessage": "No USB-PD IC\ndetected!",
"LockingKeysString": "已鎖定",
"UnlockingKeysString": "已解除鎖定",
"WarningKeysLockedString": "!按鍵鎖定!"
},
"characters": {
"SettingRightChar": "右",
"SettingLeftChar": "左",
"SettingAutoChar": "自",
"SettingFastChar": "快",
"SettingSlowChar": "慢",
"SettingStartSolderingChar": "焊",
"SettingStartSleepChar": "待",
"SettingStartSleepOffChar": "室",
"SettingStartNoneChar": "無",
"SettingSensitivityOff": "關",
"SettingSensitivityLow": "低",
"SettingSensitivityMedium": "中",
"SettingSensitivityHigh": "高",
"SettingLockDisableChar": "無",
"SettingLockBoostChar": "增",
"SettingLockFullChar": "全"
},
"menuGroups": {
"SolderingMenu": {
"text2": [
"",
"焊接設定"
],
"desc": "焊接設定"
},
"PowerSavingMenu": {
"text2": [
"",
"待機設定"
],
"desc": "自動待機省電設定"
},
"UIMenu": {
"text2": [
"",
"使用者介面"
],
"desc": "使用者介面設定"
},
"AdvancedMenu": {
"text2": [
"",
"進階設定"
],
"desc": "進階設定"
}
},
"menuOptions": {
"DCInCutoff": {
"text2": [
"",
"電源"
],
"desc": "輸入電源;設定自動停機電壓 <DC 10V> <S 鋰電池以每顆3.3V計算;此設定會停用功率限制>"
},
"SleepTemperature": {
"text2": [
"",
"待機溫度"
],
"desc": "於待機模式時的鉻鐵頭溫度"
},
"SleepTimeout": {
"text2": [
"",
"待機延時"
],
"desc": "自動進入待機模式前的閒置等候時間 <S=秒 | M=分鐘>"
},
"ShutdownTimeout": {
"text2": [
"",
"自動關機"
],
"desc": "自動關機前的閒置等候時間 <M=分鐘>"
},
"MotionSensitivity": {
"text2": [
"",
"動作敏感度"
],
"desc": "0=停用 | 1=最低敏感度 | ... | 9=最高敏感度"
},
"TemperatureUnit": {
"text2": [
"",
"溫標"
],
"desc": "C=攝氏 | F=華氏"
},
"AdvancedIdle": {
"text2": [
"",
"詳細閒置畫面"
],
"desc": "於閒置畫面以英文小字型顯示詳細資料"
},
"DisplayRotation": {
"text2": [
"",
"畫面方向"
],
"desc": "A=自動 | L=使用左手 | R=使用右手"
},
"BoostTemperature": {
"text2": [
"",
"增熱溫度"
],
"desc": "於增熱模式時使用的溫度"
},
"AutoStart": {
"text2": [
"",
"自動啟用"
],
"desc": "開機時自動啟用 <無=停用 | 焊=焊接模式 | 待=待機模式 | 室=室溫待機>"
},
"CooldownBlink": {
"text2": [
"",
"降溫時閃爍"
],
"desc": "停止加熱之後,當鉻鐵頭仍處於高溫時閃爍畫面"
},
"TemperatureCalibration": {
"text2": [
"",
"溫度校正?"
],
"desc": "開始校正鉻鐵頭溫度位移"
},
"SettingsReset": {
"text2": [
"",
"全部重設?"
],
"desc": "將所有設定重設到預設值"
},
"VoltageCalibration": {
"text2": [
"",
"輸入電壓校正?"
],
"desc": "開始校正VIN輸入電壓 <長按以退出>"
},
"AdvancedSoldering": {
"text2": [
"",
"詳細焊接畫面"
],
"desc": "於焊接模式畫面以英文小字型顯示詳細資料"
},
"ScrollingSpeed": {
"text2": [
"",
"捲動速度"
],
"desc": "解說文字的捲動速度"
},
"TipModel": {
"text2": [
"Tip",
"model"
],
"desc": "Tip model selection"
},
"SimpleCalibrationMode": {
"text2": [
"Simple",
"calibration"
],
"desc": "Using hot water to calibrate tip"
},
"AdvancedCalibrationMode": {
"text2": [
"Advanced",
"calibration"
],
"desc": "Using a thermocouple on the tip to calibrate it"
},
"QCMaxVoltage": {
"text2": [
"",
"QC電壓"
],
"desc": "使用QC電源時請求的最高目標電壓"
},
"PowerLimit": {
"text2": [
"",
"功率限制"
],
"desc": "限制鉻鐵可用的最大功率 <W=watt瓦特>"
},
"ReverseButtonTempChange": {
"text2": [
"",
"調換加減鍵"
],
"desc": "調校溫度時調換加減鍵的方向"
},
"TempChangeShortStep": {
"text2": [
"",
"溫度調整 短"
],
"desc": "調校溫度時短按一下的溫度變幅"
},
"TempChangeLongStep": {
"text2": [
"",
"溫度調整 長"
],
"desc": "調校溫度時長按按鍵的溫度變幅"
},
"PowerPulsePower": {
"text2": [
"",
"電源脈衝"
],
"desc": "為保持電源喚醒而通電所用的功率 <watt瓦特>"
},
"TipGain": {
"text2": [
"",
"溫度增幅"
],
"desc": "鉻鐵頭溫度增幅"
},
"HallEffSensitivity": {
"text2": [
"",
"磁場敏感度"
],
"desc": "磁場感應器用作啟動待機模式的敏感度 <關=停用 | 低=最低敏感度 | 中=中等敏感度 | 高=最高敏感度>"
},
"LockingMode": {
"text2": [
"",
"按鍵鎖定"
],
"desc": "於焊接模式時,同時長按兩個按鍵啟用按鍵鎖定 <無=停用 | 增=只鎖定增熱模式 | 全=鎖定全部>"
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,341 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Library General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) year name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Library General
Public License instead of this License.

View File

@@ -0,0 +1,11 @@
This directory contains files included from the WenQuanYi Bitmap Song font
release, obtainable on the project's [SourceForge download page][wqy-sf].
The project author, Fang QianQian, kindly agreed to provide the font using the
"GPLv2 or later" license in order to be compatible with IronOS, which is
licensed under GPLv3. The release package with the changed license was made
available via the project's SourceForge page on 2021-02-03 with the file name
[`wqy-bitmapsong-bdf-1.0.0-RC1_GPLv2+.tar.gz`][wqy-sf-dl].
[wqy-sf]: https://sourceforge.net/projects/wqy/files/wqy-bitmapfont/1.0.0-RC1/
[wqy-sf-dl]: https://sourceforge.net/projects/wqy/files/wqy-bitmapfont/1.0.0-RC1/wqy-bitmapsong-bdf-1.0.0-RC1_GPLv2%2B.tar.gz/download.

View File

@@ -0,0 +1,164 @@
==========================================================
Wen Quan Yi Bitmap Song CJK Fonts
Release Notes
----------------------------------------------------------
Dedication:
----------------------------------------------------------
Summary:
Authors : WenQuanYi Contributors
Webpage : http://wenq.org/en/
Font Name: WenQuanYi Bitmap Song
Version : 1.0 (Hero) RC1 (0.9.9.8)
Release : 8
Copyright: <20> 2004-2010, The WenQuanYi Project
Board of Trustees and Qianqian Fang
License : GPL v2 or later version (with font embedding exception **)
----------------------------------------------------------
May the Font be with you, forever!
----------------------------------------------------------
Legal Disclaimer:
Copyright (c) 2004-2010, The WenQuanYi Project
Board of Trustees and Qianqian Fang
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
----------------------------------------------------------
Table of Content
I. Introduction
II. Installation
III. About "The WenQuanYi Project"
IV. Links to Open-source CJK font resources
----------------------------------------------------------
I. Introduction
WenQuanYi bitmap fonts include all 20,932 Unicode 5.2
CJK Unified Ideographs (U4E00 - U9FA5) and 6,582
CJK Extension A characters (U3400 - U4DB5) at
5 different pixel sizes (9pt-12X12, 10pt-13X13,
10.5pt-14x14, 11pt-15X15 and 12pt-16x16 pixel).
Use of this bitmap font for on-screen display of Chinese
(traditional and simplified) in web pages and elsewhere
eliminates the annoying "blurring" problems caused by
insufficient "hinting" of anti-aliased vector CJK fonts.
In addition, Latin characters, Japanese Kanas and
Korean Hangul glyphs (U+AC00~U+D7A3) are also included.
This font was built upon the previous works by firefly
(firefly[at]firefly(dot)idv(dot)tw)[2]. The 12pt bitmap
glyphs between U3400-U9FA5 were derived from Chinese
national standard GB19966-2005 [3].
We release this font to the public as an open-source
software in terms of GNU General Public License version 2.
You are free to copy, distribute, and/or modify this
font as long as you pass the freedoms to the users
of the derived work.
We hope you find this font useful. Please direct your
feedback and bug-reports to our forum at
http://wenq.org/forum/
In addition to bitmap font development, we also develop
vector fonts and other CJK-related resources at WenQuanYi.
Please join us by visiting our website at
http://wenq.org/en/
We also welcome donations if you found this font to be
useful to you.
----------------------------------------------------------
II. Installation Guide
Please refer to INSTALL for details.
----------------------------------------------------------
III. About The WenQuanYi Project
The Wen Quan Yi Project was founded by Qianqian Fang[5] in
Oct. 2004. The goal of this project is to develop CJK
related open-source software and resources. The initial
effots of the project focused on creating high quality
bitmap character glyphs and outline fonts for all
70,000+ CJK characters currently encoded by the
Unicode Consortium [4].
The contributors of the Wen Quan Yi Project use wiki[1]
as the primary development tool for glyph creation, documentation
and coordinations. The Wen Quan Yi wiki (Habitat wiki:
http://wenq.org/habitat/ ) was developed by Qianqian Fang
based on UseModWiki v1.0.
For commercial use, please contact the project
maintainer (Qianqian Fang) or consult copyright law firms to
make sure your plan is compliant with the font licenses.
Commercial licenses are also available upon request.
----------------------------------------------------------
IV. Links to Open-source CJK font resources
[1] The WenQuanYi Project Homepage
http://wenq.org/ (Chinese version)
http://wenq.org/en/ (English version)
http://wenq.org/forum/ (User forum)
[2] Firefly bitmap font
http://www.study-area.org/apt/firefly-font/
[3] Chinese National Standard GB19966-2005 (mandatory)
http://www.standardcn.com/standard_plan/list_standard_content.asp?
stand_id=GB@19966-2005
[4] The Unicode Consortium
http://www.unicode.org/
[5] Qianqian Fang homepage
http://nmr.mgh.harvard.edu/~fangq/
** GPL v2.0 license with font embedding exception:
As a special exception, if you create a document which uses this
font, and embed this font or unaltered portions of this font into
the document, this font does not by itself cause the resulting
document to be covered by the GNU General Public License. This
exception does not however invalidate any other reasons why the
document might be covered by the GNU General Public License. If you
modify this font, you may extend this exception to your version of
the font, but you are not obligated to do so. If you do not wish to
do so, delete this exception statement from your version.
==========================================================

File diff suppressed because it is too large Load Diff

View File

@@ -1,7 +1,8 @@
#!/bin/bash
set -e
# Setup shell file to setup the environment on an ubuntu machine
sudo apt-get update && sudo apt-get install -y make bzip2 git python3 wget
sudo apt-get update && sudo apt-get install -y make bzip2 git python3 python3-pip wget
python3 -m pip install bdflib
sudo mkdir -p /build
cd /build

View File

@@ -125,7 +125,7 @@ void OLED::drawChar(char c) {
} else if (c == 0) {
return;
}
uint16_t index = c - 2; // First index is \x02
uint16_t index = static_cast<unsigned char>(c) - 2; // First index is \x02
uint8_t *charPointer;
charPointer = ((uint8_t *)currentFont) + ((fontWidth * (fontHeight / 8)) * index);
drawArea(cursor_x, cursor_y, fontWidth, fontHeight, charPointer);

View File

@@ -211,15 +211,22 @@ const menuitem advancedMenu[] = {
};
static void printShortDescriptionDoubleLine(uint32_t shortDescIndex) {
OLED::setFont(1);
OLED::setCharCursor(0, 0);
OLED::print(SettingsShortNames[shortDescIndex][0]);
OLED::setCharCursor(0, 1);
OLED::print(SettingsShortNames[shortDescIndex][1]);
if (SettingsShortNames[shortDescIndex][0][0] == '\x00') {
// Empty first line means that this uses large font (for CJK).
OLED::setFont(0);
OLED::setCharCursor(0, 0);
OLED::print(SettingsShortNames[shortDescIndex][1]);
} else {
OLED::setFont(1);
OLED::setCharCursor(0, 0);
OLED::print(SettingsShortNames[shortDescIndex][0]);
OLED::setCharCursor(0, 1);
OLED::print(SettingsShortNames[shortDescIndex][1]);
}
}
/**
* Prints two small lines of short description
* Prints two small lines (or one line for CJK) of short description
* and prepares cursor in big font after it.
* @param shortDescIndex Index to of short description.
* @param cursorCharPosition Custom cursor char position to set after printing
@@ -632,6 +639,7 @@ static bool settings_setResetSettings(void) {
resetSettings();
OLED::setFont(0);
OLED::clearScreen();
OLED::setCursor(0, 0);
OLED::print(ResetOKMessage);
OLED::refresh();
@@ -871,10 +879,17 @@ static bool settings_setHallEffect(void) {
#endif
static void displayMenu(size_t index) {
// Call into the menu
OLED::setFont(1);
const char *textPtr = SettingsMenuEntries[index];
if (textPtr[0] == '\x01') { // `\x01` is used as newline.
// Empty first line means that this uses large font (for CJK).
OLED::setFont(0);
textPtr++;
} else {
OLED::setFont(1);
}
OLED::setCursor(0, 0);
// Draw title
OLED::print(SettingsMenuEntries[index]);
OLED::print(textPtr);
// Draw symbol
// 16 pixel wide image
// 2 pixel wide scrolling indicator

View File

@@ -720,7 +720,12 @@ void showDebugMenu(void) {
void showWarnings() {
// Display alert if settings were reset
if (settingsWereReset) {
warnUser(SettingsResetMessage, 1, 10 * TICKS_SECOND);
if (SettingsResetMessage[0] == '\x01') { // `\x01` is used as newline.
// Empty first line means that this uses large font (for CJK).
warnUser(SettingsResetMessage + 1, 0, 10 * TICKS_SECOND);
} else {
warnUser(SettingsResetMessage, 1, 10 * TICKS_SECOND);
}
}
#ifndef NO_WARN_MISSING
// We also want to alert if accel or pd is not detected / not responding

View File

@@ -10,7 +10,7 @@ ifneq ($(model),$(filter $(model),$(ALL_MODELS)))
$(error Invalid model '$(model)', valid options are: $(ALL_MODELS))
endif
ALL_LANGUAGES=BG CS DA DE EN ES FI FR HR HU IT LT NL NL_BE NO PL PT RU SK SL SR_CYRL SR_LATN SV TR UK
ALL_LANGUAGES=BG CS DA DE EN ES FI FR HR HU IT LT NL NL_BE NO PL PT RU SK SL SR_CYRL SR_LATN SV TR UK YUE_HK ZH_TW
# Enumerate all of the include directories