Introduce separate fonts used by blockdiag, sequdiag, actdiag, nwdiag, rackdiag and packetdiag for Chinese and English version of documentation

This commit is contained in:
Krzysztof 2019-04-01 09:12:08 +08:00
parent 394d89e7da
commit 754a454402
7 changed files with 39 additions and 66 deletions

4
.gitignore vendored
View file

@ -36,6 +36,10 @@ docs/*/xml_in/
docs/*/man/
docs/doxygen_sqlite3.db
# Downloaded font files
docs/_static/DejaVuSans.ttf
docs/_static/NotoSansSC-Regular.otf
# Unit test app files
tools/unit-test-app/sdkconfig
tools/unit-test-app/sdkconfig.old

View file

@ -1,58 +0,0 @@
This package was debianized by Peter Cernak <pce@users.sourceforge.net> on
Sun, 5 Sep 2004 17:10:26 +0200.
It was downloaded from http://dejavu.sourceforge.net/
Upstream Authors: Stepan Roh <src@users.sourceforge.net> (original author),
see /usr/share/doc/ttf-dejavu/AUTHORS for full list
Copyright:
Fonts are (c) Bitstream (see below). DejaVu changes are in public domain.
Bitstream Vera Fonts Copyright
------------------------------
Copyright (c) 2003 by Bitstream, Inc. All Rights Reserved. Bitstream Vera is
a trademark of Bitstream, Inc.
Permission is hereby granted, free of charge, to any person obtaining a copy
of the fonts accompanying this license ("Fonts") and associated
documentation files (the "Font Software"), to reproduce and distribute the
Font Software, including without limitation the rights to use, copy, merge,
publish, distribute, and/or sell copies of the Font Software, and to permit
persons to whom the Font Software is furnished to do so, subject to the
following conditions:
The above copyright and trademark notices and this permission notice shall
be included in all copies of one or more of the Font Software typefaces.
The Font Software may be modified, altered, or added to, and in particular
the designs of glyphs or characters in the Fonts may be modified and
additional glyphs or characters may be added to the Fonts, only if the fonts
are renamed to names not containing either the words "Bitstream" or the word
"Vera".
This License becomes null and void to the extent applicable to Fonts or Font
Software that has been modified and is distributed under the "Bitstream
Vera" names.
The Font Software may be sold as part of a larger software package but no
copy of one or more of the Font Software typefaces may be sold by itself.
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 BITSTREAM OR THE GNOME
FOUNDATION 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.
Except as contained in this notice, the names of Gnome, the Gnome
Foundation, and Bitstream Inc., shall not be used in advertising or
otherwise to promote the sale, use or other dealings in this Font Software
without prior written authorization from the Gnome Foundation or Bitstream
Inc., respectively. For further information, contact: fonts at gnome dot
org.

Binary file not shown.

View file

@ -152,14 +152,6 @@ extensions = ['breathe',
'html_redirects',
]
# Set up font for blockdiag, nwdiag, rackdiag and packetdiag
blockdiag_fontpath = '../_static/DejaVuSans.ttf'
seqdiag_fontpath = '../_static/DejaVuSans.ttf'
actdiag_fontpath = '../_static/DejaVuSans.ttf'
nwdiag_fontpath = '../_static/DejaVuSans.ttf'
rackdiag_fontpath = '../_static/DejaVuSans.ttf'
packetdiag_fontpath = '../_static/DejaVuSans.ttf'
# Enabling this fixes cropping of blockdiag edge labels
seqdiag_antialias = True

View file

@ -10,6 +10,7 @@ import sys
import os
sys.path.insert(0, os.path.abspath('..'))
from conf_common import * # noqa: F401, F403 - need to make available everything from common
from local_util import download_file # noqa: E402 - need to import from common folder
# General information about the project.
project = u'ESP-IDF Programming Guide'
@ -18,3 +19,15 @@ copyright = u'2016 - 2019, Espressif Systems (Shanghai) CO., LTD'
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
language = 'en'
# Download font file that is stored on a separate server to save on esp-idf repository size.
print("Downloading font file")
download_file('https://dl.espressif.com/dl/esp-idf/docs/_static/DejaVuSans.ttf', '../_static')
# Set up font for blockdiag, nwdiag, rackdiag and packetdiag
blockdiag_fontpath = '../_static/DejaVuSans.ttf'
seqdiag_fontpath = '../_static/DejaVuSans.ttf'
actdiag_fontpath = '../_static/DejaVuSans.ttf'
nwdiag_fontpath = '../_static/DejaVuSans.ttf'
rackdiag_fontpath = '../_static/DejaVuSans.ttf'
packetdiag_fontpath = '../_static/DejaVuSans.ttf'

View file

@ -18,6 +18,7 @@ from __future__ import unicode_literals
from io import open
import os
import shutil
import urllib
def run_cmd_get_output(cmd):
@ -55,3 +56,11 @@ def copy_if_modified(src_path, dst_path):
src_file_path = os.path.join(root, src_file_name)
dst_file_path = os.path.join(dst_path + root[src_path_len:], src_file_name)
copy_file_if_modified(src_file_path, dst_file_path)
def download_file(from_url, to_path):
tmp_file, header = urllib.urlretrieve(from_url)
filename = os.path.basename(from_url)
with open(to_path + "/" + filename, 'wb') as fobj:
with open(tmp_file, 'rb') as tmp:
fobj.write(tmp.read())

View file

@ -10,6 +10,7 @@ import sys
import os
sys.path.insert(0, os.path.abspath('..'))
from conf_common import * # noqa: F401, F403 - need to make available everything from common
from local_util import download_file # noqa: E402 - need to import from common folder
# General information about the project.
project = u'ESP-IDF 编程指南'
@ -18,3 +19,15 @@ copyright = u'2016 - 2019 乐鑫信息科技(上海)股份有限公司'
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
language = 'zh_CN'
# Download font file that is stored on a separate server to save on esp-idf repository size.
print("Downloading font file")
download_file('https://dl.espressif.com/dl/esp-idf/docs/_static/NotoSansSC-Regular.otf', '../_static')
# Set up font for blockdiag, nwdiag, rackdiag and packetdiag
blockdiag_fontpath = '../_static/NotoSansSC-Regular.otf'
seqdiag_fontpath = '../_static/NotoSansSC-Regular.otf'
actdiag_fontpath = '../_static/NotoSansSC-Regular.otf'
nwdiag_fontpath = '../_static/NotoSansSC-Regular.otf'
rackdiag_fontpath = '../_static/NotoSansSC-Regular.otf'
packetdiag_fontpath = '../_static/NotoSansSC-Regular.otf'