Update the scripts to make the font source file fully reproducible.
This commit is contained in:
parent
216541c9a3
commit
95b9196703
|
@ -65737,7 +65737,11 @@ const char* const newstroke_font[] =
|
|||
const int newstroke_font_bufsize = sizeof(newstroke_font)/sizeof(newstroke_font[0]);
|
||||
|
||||
/* --- unused glyphs --- */
|
||||
/* RECTANGLE_V_BLACK_SMALL */
|
||||
/* TRIANGLE_TALL_BLACK */
|
||||
/* COMBINING */
|
||||
/* C_CAP_REV */
|
||||
/* C_SMALL_REV */
|
||||
/* DIAMOND_SMALL */
|
||||
/* DOT_MACRON */
|
||||
/* RECTANGLE_V_BLACK_SMALL */
|
||||
/* TILDE_MACRON */
|
||||
/* TRIANGLE_TALL_BLACK */
|
||||
|
|
|
@ -9,11 +9,20 @@ Files
|
|||
-----
|
||||
font.lib - main glyph library in KiCAD library format
|
||||
symbol.lib - glyph library for most math, tech and other symbols
|
||||
font_draft1.lib - old draft glyph library with the metrics from Hersheys Simplex
|
||||
font.pro - KiCAD project
|
||||
CJK_symbol.lib - CJK symbols
|
||||
CKJ_wide.lib - CJK characters, widened by a factor of 1.5
|
||||
katakana.lib - Japanese script
|
||||
hiragana.lib - Japanese script
|
||||
half_full.lib - U+FF00 half- and full-width forms
|
||||
charlist.txt - unicode glyph map list
|
||||
fontconv.awk - AWK script for 'compiling' project to c-source used by KiCAD
|
||||
newstroke_font.h - generated c header with font
|
||||
../../common/newstroke_font.cpp
|
||||
- C source with the font, generated by fontconv.awk
|
||||
|
||||
Other Files
|
||||
-----------
|
||||
font_draft1.lib - old draft glyph library with the metrics from Hersheys Simplex
|
||||
font.pro - KiCAD project
|
||||
|
||||
Requirements
|
||||
------------
|
||||
|
@ -22,11 +31,22 @@ AWK - for font generating
|
|||
|
||||
Usage
|
||||
-----
|
||||
* Edit glyps with KiCAD EESchema library editor.
|
||||
* Edit glyps with KiCAD 5.1 EESchema library editor.
|
||||
See the note below for special handling of CJK_wide.lib
|
||||
* Add Unicode positions to charlist.
|
||||
* Generate font using following command line:
|
||||
|
||||
awk -f fontconv.awk symbol.lib font.lib charlist.txt >newstroke_font.h
|
||||
awk -f fontconv.awk symbol.lib font.lib CJK_symbol.lib CKJ_wide.lib \
|
||||
hiragana.lib katakana.lib half_full.lib charlist.txt \
|
||||
>../../common/newstroke_font.cpp
|
||||
|
||||
Note
|
||||
----
|
||||
The CKJ_wide.lib file is not editable using EESchema editor directly.
|
||||
To edit:
|
||||
* Unscale the file back to CKJ_lib.lib using unscale.py
|
||||
* Edit glyphs using KiCAD 5.1 EESchema library editor.
|
||||
* Rescale the file from CKJ_lib.lib to CKJ_wide.lib using scale.py
|
||||
|
||||
|
||||
Released under CC0 licence.
|
||||
|
|
|
@ -97,7 +97,7 @@ font newstroke_font
|
|||
+ BRACE
|
||||
+ LINE_V
|
||||
+ !BRACE
|
||||
+ TILDE
|
||||
+ TILDE_U+007E
|
||||
+ DEL
|
||||
|
||||
// LATIN-1 SUPPLEMENT (0080-00FF)
|
||||
|
@ -2918,6 +2918,7 @@ skipcodes 256 0
|
|||
// Miscellaneous Symbols and Arrows (2B00-2BFF)
|
||||
skipcodes 256 0
|
||||
|
||||
// Skip to CJK
|
||||
skipcodes 1024 0
|
||||
|
||||
// CJK Symbols and Punctuation (3000-303F)
|
||||
|
|
|
@ -6949,6 +6949,20 @@ X ~ ~ 400 0 300 U 50 50 1 1 I
|
|||
ENDDRAW
|
||||
ENDDEF
|
||||
#
|
||||
# TILDE_U+007E
|
||||
#
|
||||
DEF TILDE_U+007E U 0 40 Y Y 1 F N
|
||||
F0 "U" 0 -250 60 H V C CNN
|
||||
F1 "TILDE_U+007E" 0 -350 60 H V C CNN
|
||||
F2 "" 0 0 50 H I C CNN
|
||||
F3 "" 0 0 50 H I C CNN
|
||||
DRAW
|
||||
P 6 0 1 0 -250 400 -200 450 -100 500 100 400 200 450 250 500 N
|
||||
X ~ ~ -350 0 300 U 50 50 1 1 I
|
||||
X ~ ~ 400 0 300 U 50 50 1 1 I
|
||||
ENDDRAW
|
||||
ENDDEF
|
||||
#
|
||||
# TITLO
|
||||
#
|
||||
DEF TITLO U 0 40 Y Y 1 F N
|
||||
|
|
|
@ -0,0 +1,148 @@
|
|||
/*
|
||||
* newstroke_font.cpp - definitions for automatically converted font
|
||||
*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2010 vladimir uryvaev <vovanius@bk.ru>
|
||||
* Copyright (C) 1992-2019 KiCad Developers, see change_log.txt for contributors.
|
||||
*
|
||||
* 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, you may find one here:
|
||||
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
* or you may search the http://www.gnu.org website for the version 2 license,
|
||||
* or you may write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
/**
|
||||
* Modified 2019 to include based CJK Unicode Ideographs, using
|
||||
* code copyright (c) 2018 Lingdong Huang
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*
|
||||
* Font used for CJK is Source Han Sans from https://github.com/adobe-fonts/source-han-sans
|
||||
* Source Han Sans is Copyright 2014-2019 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.
|
||||
*/
|
||||
|
||||
#include <newstroke_font.h>
|
|
@ -3,7 +3,11 @@
|
|||
# awk script to convert KiCAD font.
|
||||
|
||||
BEGIN {
|
||||
print "/* Automatically converted font */"
|
||||
fn_header = "font_header.cpp"
|
||||
while (getline line < fn_header)
|
||||
print line
|
||||
close(fn_header)
|
||||
|
||||
missed = 0
|
||||
printstats = 1
|
||||
|
||||
|
@ -269,9 +273,10 @@ $1 == "ENDDEF" {
|
|||
# parsing font index
|
||||
$1 == "font" {
|
||||
print fontend
|
||||
print "const static char* "$2"[] ="
|
||||
print "\n"
|
||||
print "const char* const "$2"[] ="
|
||||
print "{"
|
||||
fontend = "};"
|
||||
fontend = "};\nconst int "$2"_bufsize = sizeof("$2")/sizeof("$2"[0]);\n"
|
||||
}
|
||||
$1 == "startchar" {
|
||||
codeno = $2
|
||||
|
@ -310,8 +315,9 @@ $1 == "+)" {
|
|||
|
||||
$1 == "skipcodes" {
|
||||
#print " // skip "$2
|
||||
skipper = codeno > 0x9000 ? "0" : symdef
|
||||
for(i = 0; i<$2; i++) {
|
||||
print " \""cesc(metric(symdef) graph(symdef))"\"," ((codeno%16)?"":sprintf(" /* U+%X */", codeno))
|
||||
print " \""cesc(metric(skipper) graph(skipper))"\"," ((codeno%16)?"":sprintf(" /* U+%X */", codeno))
|
||||
codeno += 1
|
||||
}
|
||||
}
|
||||
|
@ -327,8 +333,9 @@ END {
|
|||
if(printstats) {
|
||||
if(missed>0) print "/* Missed glyphs: " missed " */"
|
||||
print "/* --- unused glyphs --- */"
|
||||
PROCINFO["sorted_in"] = "@val_str_asc"
|
||||
for(f in fi) {
|
||||
if(0==fontuse[f]) print "/* "f" */"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,19 +1,10 @@
|
|||
import os
|
||||
|
||||
i = 0
|
||||
|
||||
with open( 'CKJ_lib.bak' ) as f:
|
||||
for line in f:
|
||||
with open('CKJ_lib.lib') as fi, open('CKJ_wide.lib', 'w') as fo:
|
||||
for line in fi:
|
||||
tok = line.split()
|
||||
if len(tok) == 0:
|
||||
print( '' )
|
||||
continue
|
||||
if tok:
|
||||
if tok[0] == 'P':
|
||||
tok[3:-2:2] = [str(int(t) * 1.5) for t in tok[3:-2:2]]
|
||||
elif tok[0] == 'X' and int(tok[3]) > 0:
|
||||
tok[3] = '1450'
|
||||
|
||||
if tok[0] == 'P':
|
||||
tok[3:-2:2] = [str( int( t ) * 1.5 ) for t in tok[3:-2:2]]
|
||||
elif tok[0] == 'X' and int( tok[3] ) > 0:
|
||||
tok[3] = '1450'
|
||||
|
||||
print( ' '.join( tok ) )
|
||||
|
||||
|
||||
print(' '.join(tok), file=fo)
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
with open('CKJ_wide.lib') as fi, open('CKJ_lib.lib', 'w') as fo:
|
||||
for line in fi:
|
||||
tok = line.split()
|
||||
if tok and tok[0] == 'P':
|
||||
tok[3:-2:2] = [str(int(float(t) / 1.5)) for t in tok[3:-2:2]]
|
||||
|
||||
print(' '.join(tok), file=fo)
|
Loading…
Reference in New Issue