mirror of
https://github.com/pierre42100/ComunicWeb
synced 2025-06-19 04:15:17 +00:00
Updated 3rdparty structure
This commit is contained in:
2940
assets/3rdparty/adminLTE/plugins/ionicons/builder/build_data.json
vendored
Normal file
2940
assets/3rdparty/adminLTE/plugins/ionicons/builder/build_data.json
vendored
Normal file
File diff suppressed because it is too large
Load Diff
38
assets/3rdparty/adminLTE/plugins/ionicons/builder/cheatsheet/icon-row.html
vendored
Normal file
38
assets/3rdparty/adminLTE/plugins/ionicons/builder/cheatsheet/icon-row.html
vendored
Normal file
@ -0,0 +1,38 @@
|
||||
<div class="icon-row">
|
||||
<div class="preview-icon"><span class="step size-12">
|
||||
<i class="icon {{prefix}}{{name}}"></i>
|
||||
</span><span class="step size-14">
|
||||
<i class="icon {{prefix}}{{name}}"></i>
|
||||
</span><span class="step size-16">
|
||||
<i class="icon {{prefix}}{{name}}"></i>
|
||||
</span><span class="step size-18">
|
||||
<i class="icon {{prefix}}{{name}}"></i>
|
||||
</span><span class="step size-21">
|
||||
<i class="icon {{prefix}}{{name}}"></i>
|
||||
</span><span class="step size-24">
|
||||
<i class="icon {{prefix}}{{name}}"></i>
|
||||
</span><span class="step size-32">
|
||||
<i class="icon {{prefix}}{{name}}"></i>
|
||||
</span><span class="step size-48">
|
||||
<i class="icon {{prefix}}{{name}}"></i>
|
||||
</span><span class="step size-64">
|
||||
<i class="icon {{prefix}}{{name}}"></i>
|
||||
</span><span class="step size-96">
|
||||
<i class="icon {{prefix}}{{name}}"></i>
|
||||
</span>
|
||||
</div>
|
||||
<div class="preview-scale"><span class="step">12</span><span class="step">14</span><span class="step">16</span><span class="step">18</span><span class="step">21</span><span class="step">24</span><span class="step">32</span><span class="step">48</span><span class="step">64</span><span class="step">96</span></div>
|
||||
<div class="usage">
|
||||
<label>Classname:</label>
|
||||
<input class="name" type="text" readonly="readonly" onClick="this.select();" value="{{prefix}}{{name}}" />
|
||||
|
||||
<label>Selectable:</label>
|
||||
<span class="ion">{{html_code}}</span>
|
||||
|
||||
<label>Escaped HTML:</label>
|
||||
<input class="html" type="text" readonly="readonly" onClick="this.select();" value="{{escaped_html_code}}" />
|
||||
|
||||
<label>CSS Content:</label>
|
||||
<input class="css" type="text" readonly="readonly" onClick="this.select();" value="{{css_code}}" />
|
||||
</div>
|
||||
</div>
|
156
assets/3rdparty/adminLTE/plugins/ionicons/builder/cheatsheet/template.html
vendored
Normal file
156
assets/3rdparty/adminLTE/plugins/ionicons/builder/cheatsheet/template.html
vendored
Normal file
@ -0,0 +1,156 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>{{font_name}} v{{font_version}} Cheatsheet</title>
|
||||
<style>
|
||||
* {
|
||||
-moz-box-sizing: border-box;
|
||||
-webkit-box-sizing: border-box;
|
||||
box-sizing: border-box;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
-webkit-touch-callout: none;
|
||||
-webkit-user-select: none;
|
||||
-khtml-user-select: none;
|
||||
-moz-user-select: none;
|
||||
-ms-user-select: none;
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
body {
|
||||
background: #fff;
|
||||
color: #444;
|
||||
font: 16px/1.5 "Helvetica Neue", Helvetica, Arial, sans-serif;
|
||||
}
|
||||
|
||||
a, a:visited {
|
||||
color: #888;
|
||||
text-decoration: underline;
|
||||
}
|
||||
a:hover, a:focus { color: #000; }
|
||||
|
||||
header {
|
||||
border-bottom: 2px solid #ddd;
|
||||
margin-bottom: 20px;
|
||||
overflow: hidden;
|
||||
padding: 20px 0;
|
||||
}
|
||||
|
||||
header h1 {
|
||||
color: #888;
|
||||
float: left;
|
||||
font-size: 36px;
|
||||
font-weight: 300;
|
||||
}
|
||||
|
||||
header a {
|
||||
float: right;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.container {
|
||||
margin: 0 auto;
|
||||
max-width: 1200px;
|
||||
min-width: 960px;
|
||||
padding: 0 20px;
|
||||
width: 95%;
|
||||
}
|
||||
|
||||
.icon-row {
|
||||
border-bottom: 1px dotted #ccc;
|
||||
padding: 10px 0 20px;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
.ion {
|
||||
-webkit-touch-callout: text;
|
||||
-webkit-user-select: text;
|
||||
-khtml-user-select: text;
|
||||
-moz-user-select: text;
|
||||
-ms-user-select: text;
|
||||
user-select: text;
|
||||
}
|
||||
|
||||
.preview-icon { vertical-align: bottom; }
|
||||
|
||||
.preview-scale {
|
||||
color: #888;
|
||||
font-size: 12px;
|
||||
margin-top: 5px;
|
||||
}
|
||||
|
||||
.step {
|
||||
display: inline-block;
|
||||
line-height: 1;
|
||||
position: relative;
|
||||
width: 10%;
|
||||
}
|
||||
|
||||
.step i {
|
||||
-webkit-transition: opacity .3s;
|
||||
-moz-transition: opacity .3s;
|
||||
-ms-transition: opacity .3s;
|
||||
-o-transition: opacity .3s;
|
||||
transition: opacity .3s;
|
||||
}
|
||||
|
||||
.step:hover i { opacity: .3; }
|
||||
|
||||
.size-12 { font-size: 12px; }
|
||||
.size-14 { font-size: 14px; }
|
||||
.size-16 { font-size: 16px; }
|
||||
.size-18 { font-size: 18px; }
|
||||
.size-21 { font-size: 21px; }
|
||||
.size-24 { font-size: 24px; }
|
||||
.size-32 { font-size: 32px; }
|
||||
.size-48 { font-size: 48px; }
|
||||
.size-64 { font-size: 64px; }
|
||||
.size-96 { font-size: 96px; }
|
||||
|
||||
.usage { margin-top: 10px; }
|
||||
.usage input {
|
||||
font-family: monospace;
|
||||
margin-right: 3px;
|
||||
padding: 2px 5px;
|
||||
text-align: center;
|
||||
-webkit-touch-callout: text;
|
||||
-webkit-user-select: text;
|
||||
-khtml-user-select: text;
|
||||
-moz-user-select: text;
|
||||
-ms-user-select: text;
|
||||
user-select: text;
|
||||
}
|
||||
|
||||
.usage label {
|
||||
font-size: 12px;
|
||||
text-align: right;
|
||||
padding: 0 3px 0 60px;
|
||||
}
|
||||
.usage label:first-child { padding-left: 0; }
|
||||
.usage .name { width: 180px; }
|
||||
.usage .html { width: 80px; }
|
||||
.usage .css { width: 80px; }
|
||||
|
||||
footer {
|
||||
color: #888;
|
||||
font-size: 12px;
|
||||
padding: 20px 0;
|
||||
}
|
||||
</style>
|
||||
<link href="css/ionicons.css" rel="stylesheet" type="text/css" />
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div class="container">
|
||||
<header>
|
||||
<h1>{{font_name}} v{{font_version}} Cheatsheet, {{icon_count}} icons:</h1>
|
||||
<p><a href="http://ionicons.com/">Ionicons Homepage</a></p>
|
||||
</header>
|
||||
<div class="content">
|
||||
{{content}}
|
||||
</div>
|
||||
<footer>
|
||||
Made with love by the <a href="http://ionicframework.com/">Ionic Framework</a>
|
||||
</footer>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
318
assets/3rdparty/adminLTE/plugins/ionicons/builder/generate.py
vendored
Normal file
318
assets/3rdparty/adminLTE/plugins/ionicons/builder/generate.py
vendored
Normal file
@ -0,0 +1,318 @@
|
||||
from subprocess import call
|
||||
import os
|
||||
import json
|
||||
|
||||
|
||||
BUILDER_PATH = os.path.dirname(os.path.abspath(__file__))
|
||||
ROOT_PATH = os.path.join(BUILDER_PATH, '..')
|
||||
FONTS_FOLDER_PATH = os.path.join(ROOT_PATH, 'fonts')
|
||||
CSS_FOLDER_PATH = os.path.join(ROOT_PATH, 'css')
|
||||
SCSS_FOLDER_PATH = os.path.join(ROOT_PATH, 'scss')
|
||||
LESS_FOLDER_PATH = os.path.join(ROOT_PATH, 'less')
|
||||
|
||||
|
||||
def main():
|
||||
generate_font_files()
|
||||
|
||||
data = get_build_data()
|
||||
|
||||
rename_svg_glyph_names(data)
|
||||
generate_scss(data)
|
||||
generate_less(data)
|
||||
generate_cheatsheet(data)
|
||||
generate_component_json(data)
|
||||
generate_composer_json(data)
|
||||
generate_bower_json(data)
|
||||
|
||||
|
||||
def generate_font_files():
|
||||
print "Generate Fonts"
|
||||
cmd = "fontforge -script %s/scripts/generate_font.py" % (BUILDER_PATH)
|
||||
call(cmd, shell=True)
|
||||
|
||||
|
||||
def rename_svg_glyph_names(data):
|
||||
# hacky and slow (but safe) way to rename glyph-name attributes
|
||||
svg_path = os.path.join(FONTS_FOLDER_PATH, 'ionicons.svg')
|
||||
svg_file = open(svg_path, 'r+')
|
||||
svg_text = svg_file.read()
|
||||
svg_file.seek(0)
|
||||
|
||||
for ionicon in data['icons']:
|
||||
# uniF2CA
|
||||
org_name = 'uni%s' % (ionicon['code'].replace('0x', '').upper())
|
||||
ion_name = 'ion-%s' % (ionicon['name'])
|
||||
svg_text = svg_text.replace(org_name, ion_name)
|
||||
|
||||
svg_file.write(svg_text)
|
||||
svg_file.close()
|
||||
|
||||
|
||||
def generate_less(data):
|
||||
print "Generate LESS"
|
||||
font_name = data['name']
|
||||
font_version = data['version']
|
||||
css_prefix = data['prefix']
|
||||
variables_file_path = os.path.join(LESS_FOLDER_PATH, '_ionicons-variables.less')
|
||||
icons_file_path = os.path.join(LESS_FOLDER_PATH, '_ionicons-icons.less')
|
||||
|
||||
d = []
|
||||
d.append('/*!');
|
||||
d.append('Ionicons, v%s' % (font_version) );
|
||||
d.append('Created by Ben Sperry for the Ionic Framework, http://ionicons.com/');
|
||||
d.append('https://twitter.com/benjsperry https://twitter.com/ionicframework');
|
||||
d.append('MIT License: https://github.com/driftyco/ionicons');
|
||||
d.append('*/');
|
||||
d.append('// Ionicons Variables')
|
||||
d.append('// --------------------------\n')
|
||||
d.append('@ionicons-font-path: "../fonts";')
|
||||
d.append('@ionicons-font-family: "%s";' % (font_name) )
|
||||
d.append('@ionicons-version: "%s";' % (font_version) )
|
||||
d.append('@ionicons-prefix: %s;' % (css_prefix) )
|
||||
d.append('')
|
||||
for ionicon in data['icons']:
|
||||
chr_code = ionicon['code'].replace('0x', '\\')
|
||||
d.append('@ionicon-var-%s: "%s";' % (ionicon['name'], chr_code) )
|
||||
f = open(variables_file_path, 'w')
|
||||
f.write( '\n'.join(d) )
|
||||
f.close()
|
||||
|
||||
d = []
|
||||
d.append('// Ionicons Icons')
|
||||
d.append('// --------------------------\n')
|
||||
|
||||
group = [ '.%s' % (data['name'].lower()) ]
|
||||
for ionicon in data['icons']:
|
||||
group.append('.@{ionicons-prefix}%s:before' % (ionicon['name']) )
|
||||
|
||||
d.append( ',\n'.join(group) )
|
||||
|
||||
d.append('{')
|
||||
d.append(' &:extend(.ion);')
|
||||
d.append('}')
|
||||
|
||||
for ionicon in data['icons']:
|
||||
chr_code = ionicon['code'].replace('0x', '\\')
|
||||
d.append('.@{ionicons-prefix}%s:before { content: @ionicon-var-%s; }' % (ionicon['name'], ionicon['name']) )
|
||||
|
||||
f = open(icons_file_path, 'w')
|
||||
f.write( '\n'.join(d) )
|
||||
f.close()
|
||||
|
||||
|
||||
def generate_scss(data):
|
||||
print "Generate SCSS"
|
||||
font_name = data['name']
|
||||
font_version = data['version']
|
||||
css_prefix = data['prefix']
|
||||
variables_file_path = os.path.join(SCSS_FOLDER_PATH, '_ionicons-variables.scss')
|
||||
icons_file_path = os.path.join(SCSS_FOLDER_PATH, '_ionicons-icons.scss')
|
||||
|
||||
d = []
|
||||
d.append('// Ionicons Variables')
|
||||
d.append('// --------------------------\n')
|
||||
d.append('$ionicons-font-path: "../fonts" !default;')
|
||||
d.append('$ionicons-font-family: "%s" !default;' % (font_name) )
|
||||
d.append('$ionicons-version: "%s" !default;' % (font_version) )
|
||||
d.append('$ionicons-prefix: %s !default;' % (css_prefix) )
|
||||
d.append('')
|
||||
for ionicon in data['icons']:
|
||||
chr_code = ionicon['code'].replace('0x', '\\')
|
||||
d.append('$ionicon-var-%s: "%s";' % (ionicon['name'], chr_code) )
|
||||
f = open(variables_file_path, 'w')
|
||||
f.write( '\n'.join(d) )
|
||||
f.close()
|
||||
|
||||
d = []
|
||||
d.append('// Ionicons Icons')
|
||||
d.append('// --------------------------\n')
|
||||
|
||||
group = [ '.%s' % (data['name'].lower()) ]
|
||||
for ionicon in data['icons']:
|
||||
group.append('.#{$ionicons-prefix}%s:before' % (ionicon['name']) )
|
||||
|
||||
d.append( ',\n'.join(group) )
|
||||
|
||||
d.append('{')
|
||||
d.append(' @extend .ion;')
|
||||
d.append('}')
|
||||
|
||||
for ionicon in data['icons']:
|
||||
chr_code = ionicon['code'].replace('0x', '\\')
|
||||
d.append('.#{$ionicons-prefix}%s:before { content: $ionicon-var-%s; }' % (ionicon['name'], ionicon['name']) )
|
||||
|
||||
f = open(icons_file_path, 'w')
|
||||
f.write( '\n'.join(d) )
|
||||
f.close()
|
||||
|
||||
generate_css_from_scss(data)
|
||||
|
||||
|
||||
def generate_css_from_scss(data):
|
||||
print "Generate CSS From SCSS"
|
||||
|
||||
scss_file_path = os.path.join(SCSS_FOLDER_PATH, 'ionicons.scss')
|
||||
css_file_path = os.path.join(CSS_FOLDER_PATH, 'ionicons.css')
|
||||
css_min_file_path = os.path.join(CSS_FOLDER_PATH, 'ionicons.min.css')
|
||||
|
||||
cmd = "sass %s %s --style compact" % (scss_file_path, css_file_path)
|
||||
call(cmd, shell=True)
|
||||
|
||||
print "Generate Minified CSS From SCSS"
|
||||
cmd = "sass %s %s --style compressed" % (scss_file_path, css_min_file_path)
|
||||
call(cmd, shell=True)
|
||||
|
||||
|
||||
def generate_cheatsheet(data):
|
||||
print "Generate Cheatsheet"
|
||||
|
||||
cheatsheet_file_path = os.path.join(ROOT_PATH, 'cheatsheet.html')
|
||||
template_path = os.path.join(BUILDER_PATH, 'cheatsheet', 'template.html')
|
||||
icon_row_path = os.path.join(BUILDER_PATH, 'cheatsheet', 'icon-row.html')
|
||||
|
||||
f = open(template_path, 'r')
|
||||
template_html = f.read()
|
||||
f.close()
|
||||
|
||||
f = open(icon_row_path, 'r')
|
||||
icon_row_template = f.read()
|
||||
f.close()
|
||||
|
||||
content = []
|
||||
|
||||
for ionicon in data['icons']:
|
||||
css_code = ionicon['code'].replace('0x', '\\')
|
||||
escaped_html_code = ionicon['code'].replace('0x', '&#x') + ';'
|
||||
html_code = ionicon['code'].replace('0x', '&#x') + ';'
|
||||
item_row = icon_row_template
|
||||
|
||||
item_row = item_row.replace('{{name}}', ionicon['name'])
|
||||
item_row = item_row.replace('{{prefix}}', data['prefix'])
|
||||
item_row = item_row.replace('{{css_code}}', css_code)
|
||||
item_row = item_row.replace('{{escaped_html_code}}', escaped_html_code)
|
||||
item_row = item_row.replace('{{html_code}}', html_code)
|
||||
|
||||
content.append(item_row)
|
||||
|
||||
template_html = template_html.replace("{{font_name}}", data["name"])
|
||||
template_html = template_html.replace("{{font_version}}", data["version"])
|
||||
template_html = template_html.replace("{{icon_count}}", str(len(data["icons"])) )
|
||||
template_html = template_html.replace("{{content}}", '\n'.join(content) )
|
||||
|
||||
f = open(cheatsheet_file_path, 'w')
|
||||
f.write(template_html)
|
||||
f.close()
|
||||
|
||||
|
||||
def generate_component_json(data):
|
||||
print "Generate component.json"
|
||||
d = {
|
||||
"name": data['name'],
|
||||
"repo": "driftyco/ionicons",
|
||||
"description": "The premium icon font for Ionic Framework.",
|
||||
"version": data['version'],
|
||||
"keywords": [],
|
||||
"dependencies": {},
|
||||
"development": {},
|
||||
"license": "MIT",
|
||||
"styles": [
|
||||
"css/%s.css" % (data['name'].lower())
|
||||
],
|
||||
"fonts": [
|
||||
"fonts/%s.eot" % (data['name'].lower()),
|
||||
"fonts/%s.svg" % (data['name'].lower()),
|
||||
"fonts/%s.ttf" % (data['name'].lower()),
|
||||
"fonts/%s.woff" % (data['name'].lower())
|
||||
]
|
||||
}
|
||||
txt = json.dumps(d, indent=4, separators=(',', ': '))
|
||||
|
||||
component_file_path = os.path.join(ROOT_PATH, 'component.json')
|
||||
f = open(component_file_path, 'w')
|
||||
f.write(txt)
|
||||
f.close()
|
||||
|
||||
|
||||
def generate_composer_json(data):
|
||||
print "Generate composer.json"
|
||||
d = {
|
||||
"name": "driftyco/ionicons",
|
||||
"description": "The premium icon font for Ionic Framework.",
|
||||
"keywords": [ "fonts", "icon font", "icons", "ionic", "web font"],
|
||||
"homepage": "http://ionicons.com/",
|
||||
"authors": [
|
||||
{
|
||||
"name": "Ben Sperry",
|
||||
"email": "ben@drifty.com",
|
||||
"role": "Designer",
|
||||
"homepage": "https://twitter.com/benjsperry"
|
||||
},
|
||||
{
|
||||
"name": "Adam Bradley",
|
||||
"email": "adam@drifty.com",
|
||||
"role": "Developer",
|
||||
"homepage": "https://twitter.com/adamdbradley"
|
||||
},
|
||||
{
|
||||
"name": "Max Lynch",
|
||||
"email": "max@drifty.com",
|
||||
"role": "Developer",
|
||||
"homepage": "https://twitter.com/maxlynch"
|
||||
}
|
||||
],
|
||||
"extra": {},
|
||||
"license": [ "MIT" ]
|
||||
}
|
||||
txt = json.dumps(d, indent=4, separators=(',', ': '))
|
||||
|
||||
composer_file_path = os.path.join(ROOT_PATH, 'composer.json')
|
||||
f = open(composer_file_path, 'w')
|
||||
f.write(txt)
|
||||
f.close()
|
||||
|
||||
|
||||
def generate_bower_json(data):
|
||||
print "Generate bower.json"
|
||||
d = {
|
||||
"name": data['name'],
|
||||
"version": data['version'],
|
||||
"homepage": "https://github.com/driftyco/ionicons",
|
||||
"authors": [
|
||||
"Ben Sperry <ben@drifty.com>",
|
||||
"Adam Bradley <adam@drifty.com>",
|
||||
"Max Lynch <max@drifty.com>"
|
||||
],
|
||||
"description": "Ionicons - free and beautiful icons from the creators of Ionic Framework",
|
||||
"main": [
|
||||
"css/%s.css" % (data['name'].lower()),
|
||||
"fonts/*"
|
||||
],
|
||||
"keywords": [ "fonts", "icon font", "icons", "ionic", "web font"],
|
||||
"license": "MIT",
|
||||
"ignore": [
|
||||
"**/.*",
|
||||
"builder",
|
||||
"node_modules",
|
||||
"bower_components",
|
||||
"test",
|
||||
"tests"
|
||||
]
|
||||
}
|
||||
txt = json.dumps(d, indent=4, separators=(',', ': '))
|
||||
|
||||
bower_file_path = os.path.join(ROOT_PATH, 'bower.json')
|
||||
f = open(bower_file_path, 'w')
|
||||
f.write(txt)
|
||||
f.close()
|
||||
|
||||
|
||||
def get_build_data():
|
||||
build_data_path = os.path.join(BUILDER_PATH, 'build_data.json')
|
||||
f = open(build_data_path, 'r')
|
||||
data = json.loads(f.read())
|
||||
f.close()
|
||||
return data
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
2940
assets/3rdparty/adminLTE/plugins/ionicons/builder/manifest.json
vendored
Normal file
2940
assets/3rdparty/adminLTE/plugins/ionicons/builder/manifest.json
vendored
Normal file
File diff suppressed because it is too large
Load Diff
466
assets/3rdparty/adminLTE/plugins/ionicons/builder/scripts/eotlitetool.py
vendored
Normal file
466
assets/3rdparty/adminLTE/plugins/ionicons/builder/scripts/eotlitetool.py
vendored
Normal file
@ -0,0 +1,466 @@
|
||||
#!/usr/bin/env python
|
||||
# ***** BEGIN LICENSE BLOCK *****
|
||||
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
#
|
||||
# The contents of this file are subject to the Mozilla Public License Version
|
||||
# 1.1 (the "License"); you may not use this file except in compliance with
|
||||
# the License. You may obtain a copy of the License at
|
||||
# http://www.mozilla.org/MPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
# for the specific language governing rights and limitations under the
|
||||
# License.
|
||||
#
|
||||
# The Original Code is font utility code.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Mozilla Corporation.
|
||||
# Portions created by the Initial Developer are Copyright (C) 2009
|
||||
# the Initial Developer. All Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
# John Daggett <jdaggett@mozilla.com>
|
||||
#
|
||||
# Alternatively, the contents of this file may be used under the terms of
|
||||
# either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
# in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
# of those above. If you wish to allow use of your version of this file only
|
||||
# under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
# use your version of this file under the terms of the MPL, indicate your
|
||||
# decision by deleting the provisions above and replace them with the notice
|
||||
# and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
# the provisions above, a recipient may use your version of this file under
|
||||
# the terms of any one of the MPL, the GPL or the LGPL.
|
||||
#
|
||||
# ***** END LICENSE BLOCK ***** */
|
||||
|
||||
# eotlitetool.py - create EOT version of OpenType font for use with IE
|
||||
#
|
||||
# Usage: eotlitetool.py [-o output-filename] font1 [font2 ...]
|
||||
#
|
||||
|
||||
# OpenType file structure
|
||||
# http://www.microsoft.com/typography/otspec/otff.htm
|
||||
#
|
||||
# Types:
|
||||
#
|
||||
# BYTE 8-bit unsigned integer.
|
||||
# CHAR 8-bit signed integer.
|
||||
# USHORT 16-bit unsigned integer.
|
||||
# SHORT 16-bit signed integer.
|
||||
# ULONG 32-bit unsigned integer.
|
||||
# Fixed 32-bit signed fixed-point number (16.16)
|
||||
# LONGDATETIME Date represented in number of seconds since 12:00 midnight, January 1, 1904. The value is represented as a signed 64-bit integer.
|
||||
#
|
||||
# SFNT Header
|
||||
#
|
||||
# Fixed sfnt version // 0x00010000 for version 1.0.
|
||||
# USHORT numTables // Number of tables.
|
||||
# USHORT searchRange // (Maximum power of 2 <= numTables) x 16.
|
||||
# USHORT entrySelector // Log2(maximum power of 2 <= numTables).
|
||||
# USHORT rangeShift // NumTables x 16-searchRange.
|
||||
#
|
||||
# Table Directory
|
||||
#
|
||||
# ULONG tag // 4-byte identifier.
|
||||
# ULONG checkSum // CheckSum for this table.
|
||||
# ULONG offset // Offset from beginning of TrueType font file.
|
||||
# ULONG length // Length of this table.
|
||||
#
|
||||
# OS/2 Table (Version 4)
|
||||
#
|
||||
# USHORT version // 0x0004
|
||||
# SHORT xAvgCharWidth
|
||||
# USHORT usWeightClass
|
||||
# USHORT usWidthClass
|
||||
# USHORT fsType
|
||||
# SHORT ySubscriptXSize
|
||||
# SHORT ySubscriptYSize
|
||||
# SHORT ySubscriptXOffset
|
||||
# SHORT ySubscriptYOffset
|
||||
# SHORT ySuperscriptXSize
|
||||
# SHORT ySuperscriptYSize
|
||||
# SHORT ySuperscriptXOffset
|
||||
# SHORT ySuperscriptYOffset
|
||||
# SHORT yStrikeoutSize
|
||||
# SHORT yStrikeoutPosition
|
||||
# SHORT sFamilyClass
|
||||
# BYTE panose[10]
|
||||
# ULONG ulUnicodeRange1 // Bits 0-31
|
||||
# ULONG ulUnicodeRange2 // Bits 32-63
|
||||
# ULONG ulUnicodeRange3 // Bits 64-95
|
||||
# ULONG ulUnicodeRange4 // Bits 96-127
|
||||
# CHAR achVendID[4]
|
||||
# USHORT fsSelection
|
||||
# USHORT usFirstCharIndex
|
||||
# USHORT usLastCharIndex
|
||||
# SHORT sTypoAscender
|
||||
# SHORT sTypoDescender
|
||||
# SHORT sTypoLineGap
|
||||
# USHORT usWinAscent
|
||||
# USHORT usWinDescent
|
||||
# ULONG ulCodePageRange1 // Bits 0-31
|
||||
# ULONG ulCodePageRange2 // Bits 32-63
|
||||
# SHORT sxHeight
|
||||
# SHORT sCapHeight
|
||||
# USHORT usDefaultChar
|
||||
# USHORT usBreakChar
|
||||
# USHORT usMaxContext
|
||||
#
|
||||
#
|
||||
# The Naming Table is organized as follows:
|
||||
#
|
||||
# [name table header]
|
||||
# [name records]
|
||||
# [string data]
|
||||
#
|
||||
# Name Table Header
|
||||
#
|
||||
# USHORT format // Format selector (=0).
|
||||
# USHORT count // Number of name records.
|
||||
# USHORT stringOffset // Offset to start of string storage (from start of table).
|
||||
#
|
||||
# Name Record
|
||||
#
|
||||
# USHORT platformID // Platform ID.
|
||||
# USHORT encodingID // Platform-specific encoding ID.
|
||||
# USHORT languageID // Language ID.
|
||||
# USHORT nameID // Name ID.
|
||||
# USHORT length // String length (in bytes).
|
||||
# USHORT offset // String offset from start of storage area (in bytes).
|
||||
#
|
||||
# head Table
|
||||
#
|
||||
# Fixed tableVersion // Table version number 0x00010000 for version 1.0.
|
||||
# Fixed fontRevision // Set by font manufacturer.
|
||||
# ULONG checkSumAdjustment // To compute: set it to 0, sum the entire font as ULONG, then store 0xB1B0AFBA - sum.
|
||||
# ULONG magicNumber // Set to 0x5F0F3CF5.
|
||||
# USHORT flags
|
||||
# USHORT unitsPerEm // Valid range is from 16 to 16384. This value should be a power of 2 for fonts that have TrueType outlines.
|
||||
# LONGDATETIME created // Number of seconds since 12:00 midnight, January 1, 1904. 64-bit integer
|
||||
# LONGDATETIME modified // Number of seconds since 12:00 midnight, January 1, 1904. 64-bit integer
|
||||
# SHORT xMin // For all glyph bounding boxes.
|
||||
# SHORT yMin
|
||||
# SHORT xMax
|
||||
# SHORT yMax
|
||||
# USHORT macStyle
|
||||
# USHORT lowestRecPPEM // Smallest readable size in pixels.
|
||||
# SHORT fontDirectionHint
|
||||
# SHORT indexToLocFormat // 0 for short offsets, 1 for long.
|
||||
# SHORT glyphDataFormat // 0 for current format.
|
||||
#
|
||||
#
|
||||
#
|
||||
# Embedded OpenType (EOT) file format
|
||||
# http://www.w3.org/Submission/EOT/
|
||||
#
|
||||
# EOT version 0x00020001
|
||||
#
|
||||
# An EOT font consists of a header with the original OpenType font
|
||||
# appended at the end. Most of the data in the EOT header is simply a
|
||||
# copy of data from specific tables within the font data. The exceptions
|
||||
# are the 'Flags' field and the root string name field. The root string
|
||||
# is a set of names indicating domains for which the font data can be
|
||||
# used. A null root string implies the font data can be used anywhere.
|
||||
# The EOT header is in little-endian byte order but the font data remains
|
||||
# in big-endian order as specified by the OpenType spec.
|
||||
#
|
||||
# Overall structure:
|
||||
#
|
||||
# [EOT header]
|
||||
# [EOT name records]
|
||||
# [font data]
|
||||
#
|
||||
# EOT header
|
||||
#
|
||||
# ULONG eotSize // Total structure length in bytes (including string and font data)
|
||||
# ULONG fontDataSize // Length of the OpenType font (FontData) in bytes
|
||||
# ULONG version // Version number of this format - 0x00020001
|
||||
# ULONG flags // Processing Flags (0 == no special processing)
|
||||
# BYTE fontPANOSE[10] // OS/2 Table panose
|
||||
# BYTE charset // DEFAULT_CHARSET (0x01)
|
||||
# BYTE italic // 0x01 if ITALIC in OS/2 Table fsSelection is set, 0 otherwise
|
||||
# ULONG weight // OS/2 Table usWeightClass
|
||||
# USHORT fsType // OS/2 Table fsType (specifies embedding permission flags)
|
||||
# USHORT magicNumber // Magic number for EOT file - 0x504C.
|
||||
# ULONG unicodeRange1 // OS/2 Table ulUnicodeRange1
|
||||
# ULONG unicodeRange2 // OS/2 Table ulUnicodeRange2
|
||||
# ULONG unicodeRange3 // OS/2 Table ulUnicodeRange3
|
||||
# ULONG unicodeRange4 // OS/2 Table ulUnicodeRange4
|
||||
# ULONG codePageRange1 // OS/2 Table ulCodePageRange1
|
||||
# ULONG codePageRange2 // OS/2 Table ulCodePageRange2
|
||||
# ULONG checkSumAdjustment // head Table CheckSumAdjustment
|
||||
# ULONG reserved[4] // Reserved - must be 0
|
||||
# USHORT padding1 // Padding - must be 0
|
||||
#
|
||||
# EOT name records
|
||||
#
|
||||
# USHORT FamilyNameSize // Font family name size in bytes
|
||||
# BYTE FamilyName[FamilyNameSize] // Font family name (name ID = 1), little-endian UTF-16
|
||||
# USHORT Padding2 // Padding - must be 0
|
||||
#
|
||||
# USHORT StyleNameSize // Style name size in bytes
|
||||
# BYTE StyleName[StyleNameSize] // Style name (name ID = 2), little-endian UTF-16
|
||||
# USHORT Padding3 // Padding - must be 0
|
||||
#
|
||||
# USHORT VersionNameSize // Version name size in bytes
|
||||
# bytes VersionName[VersionNameSize] // Version name (name ID = 5), little-endian UTF-16
|
||||
# USHORT Padding4 // Padding - must be 0
|
||||
#
|
||||
# USHORT FullNameSize // Full name size in bytes
|
||||
# BYTE FullName[FullNameSize] // Full name (name ID = 4), little-endian UTF-16
|
||||
# USHORT Padding5 // Padding - must be 0
|
||||
#
|
||||
# USHORT RootStringSize // Root string size in bytes
|
||||
# BYTE RootString[RootStringSize] // Root string, little-endian UTF-16
|
||||
|
||||
|
||||
|
||||
import optparse
|
||||
import struct
|
||||
|
||||
class FontError(Exception):
|
||||
"""Error related to font handling"""
|
||||
pass
|
||||
|
||||
def multichar(str):
|
||||
vals = struct.unpack('4B', str[:4])
|
||||
return (vals[0] << 24) + (vals[1] << 16) + (vals[2] << 8) + vals[3]
|
||||
|
||||
def multicharval(v):
|
||||
return struct.pack('4B', (v >> 24) & 0xFF, (v >> 16) & 0xFF, (v >> 8) & 0xFF, v & 0xFF)
|
||||
|
||||
class EOT:
|
||||
EOT_VERSION = 0x00020001
|
||||
EOT_MAGIC_NUMBER = 0x504c
|
||||
EOT_DEFAULT_CHARSET = 0x01
|
||||
EOT_FAMILY_NAME_INDEX = 0 # order of names in variable portion of EOT header
|
||||
EOT_STYLE_NAME_INDEX = 1
|
||||
EOT_VERSION_NAME_INDEX = 2
|
||||
EOT_FULL_NAME_INDEX = 3
|
||||
EOT_NUM_NAMES = 4
|
||||
|
||||
EOT_HEADER_PACK = '<4L10B2BL2H7L18x'
|
||||
|
||||
class OpenType:
|
||||
SFNT_CFF = multichar('OTTO') # Postscript CFF SFNT version
|
||||
SFNT_TRUE = 0x10000 # Standard TrueType version
|
||||
SFNT_APPLE = multichar('true') # Apple TrueType version
|
||||
|
||||
SFNT_UNPACK = '>I4H'
|
||||
TABLE_DIR_UNPACK = '>4I'
|
||||
|
||||
TABLE_HEAD = multichar('head') # TrueType table tags
|
||||
TABLE_NAME = multichar('name')
|
||||
TABLE_OS2 = multichar('OS/2')
|
||||
TABLE_GLYF = multichar('glyf')
|
||||
TABLE_CFF = multichar('CFF ')
|
||||
|
||||
OS2_FSSELECTION_ITALIC = 0x1
|
||||
OS2_UNPACK = '>4xH2xH22x10B4L4xH14x2L'
|
||||
|
||||
HEAD_UNPACK = '>8xL'
|
||||
|
||||
NAME_RECORD_UNPACK = '>6H'
|
||||
NAME_ID_FAMILY = 1
|
||||
NAME_ID_STYLE = 2
|
||||
NAME_ID_UNIQUE = 3
|
||||
NAME_ID_FULL = 4
|
||||
NAME_ID_VERSION = 5
|
||||
NAME_ID_POSTSCRIPT = 6
|
||||
PLATFORM_ID_UNICODE = 0 # Mac OS uses this typically
|
||||
PLATFORM_ID_MICROSOFT = 3
|
||||
ENCODING_ID_MICROSOFT_UNICODEBMP = 1 # with Microsoft platformID BMP-only Unicode encoding
|
||||
LANG_ID_MICROSOFT_EN_US = 0x0409 # with Microsoft platformID EN US lang code
|
||||
|
||||
def eotname(ttf):
|
||||
i = ttf.rfind('.')
|
||||
if i != -1:
|
||||
ttf = ttf[:i]
|
||||
return ttf + '.eotlite'
|
||||
|
||||
def readfont(f):
|
||||
data = open(f, 'rb').read()
|
||||
return data
|
||||
|
||||
def get_table_directory(data):
|
||||
"""read the SFNT header and table directory"""
|
||||
datalen = len(data)
|
||||
sfntsize = struct.calcsize(OpenType.SFNT_UNPACK)
|
||||
if sfntsize > datalen:
|
||||
raise FontError, 'truncated font data'
|
||||
sfntvers, numTables = struct.unpack(OpenType.SFNT_UNPACK, data[:sfntsize])[:2]
|
||||
if sfntvers != OpenType.SFNT_CFF and sfntvers != OpenType.SFNT_TRUE:
|
||||
raise FontError, 'invalid font type';
|
||||
|
||||
font = {}
|
||||
font['version'] = sfntvers
|
||||
font['numTables'] = numTables
|
||||
|
||||
# create set of offsets, lengths for tables
|
||||
table_dir_size = struct.calcsize(OpenType.TABLE_DIR_UNPACK)
|
||||
if sfntsize + table_dir_size * numTables > datalen:
|
||||
raise FontError, 'truncated font data, table directory extends past end of data'
|
||||
table_dir = {}
|
||||
for i in range(0, numTables):
|
||||
start = sfntsize + i * table_dir_size
|
||||
end = start + table_dir_size
|
||||
tag, check, bongo, dirlen = struct.unpack(OpenType.TABLE_DIR_UNPACK, data[start:end])
|
||||
table_dir[tag] = {'offset': bongo, 'length': dirlen, 'checksum': check}
|
||||
|
||||
font['tableDir'] = table_dir
|
||||
|
||||
return font
|
||||
|
||||
def get_name_records(nametable):
|
||||
"""reads through the name records within name table"""
|
||||
name = {}
|
||||
# read the header
|
||||
headersize = 6
|
||||
count, strOffset = struct.unpack('>2H', nametable[2:6])
|
||||
namerecsize = struct.calcsize(OpenType.NAME_RECORD_UNPACK)
|
||||
if count * namerecsize + headersize > len(nametable):
|
||||
raise FontError, 'names exceed size of name table'
|
||||
name['count'] = count
|
||||
name['strOffset'] = strOffset
|
||||
|
||||
# read through the name records
|
||||
namerecs = {}
|
||||
for i in range(0, count):
|
||||
start = headersize + i * namerecsize
|
||||
end = start + namerecsize
|
||||
platformID, encodingID, languageID, nameID, namelen, offset = struct.unpack(OpenType.NAME_RECORD_UNPACK, nametable[start:end])
|
||||
if platformID != OpenType.PLATFORM_ID_MICROSOFT or \
|
||||
encodingID != OpenType.ENCODING_ID_MICROSOFT_UNICODEBMP or \
|
||||
languageID != OpenType.LANG_ID_MICROSOFT_EN_US:
|
||||
continue
|
||||
namerecs[nameID] = {'offset': offset, 'length': namelen}
|
||||
|
||||
name['namerecords'] = namerecs
|
||||
return name
|
||||
|
||||
def make_eot_name_headers(fontdata, nameTableDir):
|
||||
"""extracts names from the name table and generates the names header portion of the EOT header"""
|
||||
nameoffset = nameTableDir['offset']
|
||||
namelen = nameTableDir['length']
|
||||
name = get_name_records(fontdata[nameoffset : nameoffset + namelen])
|
||||
namestroffset = name['strOffset']
|
||||
namerecs = name['namerecords']
|
||||
|
||||
eotnames = (OpenType.NAME_ID_FAMILY, OpenType.NAME_ID_STYLE, OpenType.NAME_ID_VERSION, OpenType.NAME_ID_FULL)
|
||||
nameheaders = []
|
||||
for nameid in eotnames:
|
||||
if nameid in namerecs:
|
||||
namerecord = namerecs[nameid]
|
||||
noffset = namerecord['offset']
|
||||
nlen = namerecord['length']
|
||||
nformat = '%dH' % (nlen / 2) # length is in number of bytes
|
||||
start = nameoffset + namestroffset + noffset
|
||||
end = start + nlen
|
||||
nstr = struct.unpack('>' + nformat, fontdata[start:end])
|
||||
nameheaders.append(struct.pack('<H' + nformat + '2x', nlen, *nstr))
|
||||
else:
|
||||
nameheaders.append(struct.pack('4x')) # len = 0, padding = 0
|
||||
|
||||
return ''.join(nameheaders)
|
||||
|
||||
# just return a null-string (len = 0)
|
||||
def make_root_string():
|
||||
return struct.pack('2x')
|
||||
|
||||
def make_eot_header(fontdata):
|
||||
"""given ttf font data produce an EOT header"""
|
||||
fontDataSize = len(fontdata)
|
||||
font = get_table_directory(fontdata)
|
||||
|
||||
# toss out .otf fonts, t2embed library doesn't support these
|
||||
tableDir = font['tableDir']
|
||||
|
||||
# check for required tables
|
||||
required = (OpenType.TABLE_HEAD, OpenType.TABLE_NAME, OpenType.TABLE_OS2)
|
||||
for table in required:
|
||||
if not (table in tableDir):
|
||||
raise FontError, 'missing required table ' + multicharval(table)
|
||||
|
||||
# read name strings
|
||||
|
||||
# pull out data from individual tables to construct fixed header portion
|
||||
# need to calculate eotSize before packing
|
||||
version = EOT.EOT_VERSION
|
||||
flags = 0
|
||||
charset = EOT.EOT_DEFAULT_CHARSET
|
||||
magicNumber = EOT.EOT_MAGIC_NUMBER
|
||||
|
||||
# read values from OS/2 table
|
||||
os2Dir = tableDir[OpenType.TABLE_OS2]
|
||||
os2offset = os2Dir['offset']
|
||||
os2size = struct.calcsize(OpenType.OS2_UNPACK)
|
||||
|
||||
if os2size > os2Dir['length']:
|
||||
raise FontError, 'OS/2 table invalid length'
|
||||
|
||||
os2fields = struct.unpack(OpenType.OS2_UNPACK, fontdata[os2offset : os2offset + os2size])
|
||||
|
||||
panose = []
|
||||
urange = []
|
||||
codepage = []
|
||||
|
||||
weight, fsType = os2fields[:2]
|
||||
panose[:10] = os2fields[2:12]
|
||||
urange[:4] = os2fields[12:16]
|
||||
fsSelection = os2fields[16]
|
||||
codepage[:2] = os2fields[17:19]
|
||||
|
||||
italic = fsSelection & OpenType.OS2_FSSELECTION_ITALIC
|
||||
|
||||
# read in values from head table
|
||||
headDir = tableDir[OpenType.TABLE_HEAD]
|
||||
headoffset = headDir['offset']
|
||||
headsize = struct.calcsize(OpenType.HEAD_UNPACK)
|
||||
|
||||
if headsize > headDir['length']:
|
||||
raise FontError, 'head table invalid length'
|
||||
|
||||
headfields = struct.unpack(OpenType.HEAD_UNPACK, fontdata[headoffset : headoffset + headsize])
|
||||
checkSumAdjustment = headfields[0]
|
||||
|
||||
# make name headers
|
||||
nameheaders = make_eot_name_headers(fontdata, tableDir[OpenType.TABLE_NAME])
|
||||
rootstring = make_root_string()
|
||||
|
||||
# calculate the total eot size
|
||||
eotSize = struct.calcsize(EOT.EOT_HEADER_PACK) + len(nameheaders) + len(rootstring) + fontDataSize
|
||||
fixed = struct.pack(EOT.EOT_HEADER_PACK,
|
||||
*([eotSize, fontDataSize, version, flags] + panose + [charset, italic] +
|
||||
[weight, fsType, magicNumber] + urange + codepage + [checkSumAdjustment]))
|
||||
|
||||
return ''.join((fixed, nameheaders, rootstring))
|
||||
|
||||
|
||||
def write_eot_font(eot, header, data):
|
||||
open(eot,'wb').write(''.join((header, data)))
|
||||
return
|
||||
|
||||
def main():
|
||||
|
||||
# deal with options
|
||||
p = optparse.OptionParser()
|
||||
p.add_option('--output', '-o', default="world")
|
||||
options, args = p.parse_args()
|
||||
|
||||
# iterate over font files
|
||||
for f in args:
|
||||
data = readfont(f)
|
||||
if len(data) == 0:
|
||||
print 'Error reading %s' % f
|
||||
else:
|
||||
eot = eotname(f)
|
||||
header = make_eot_header(data)
|
||||
write_eot_font(eot, header, data)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
||||
|
173
assets/3rdparty/adminLTE/plugins/ionicons/builder/scripts/generate_font.py
vendored
Executable file
173
assets/3rdparty/adminLTE/plugins/ionicons/builder/scripts/generate_font.py
vendored
Executable file
@ -0,0 +1,173 @@
|
||||
# Font generation script from FontCustom
|
||||
# https://github.com/FontCustom/fontcustom/
|
||||
# http://fontcustom.com/
|
||||
|
||||
import fontforge
|
||||
import os
|
||||
import md5
|
||||
import subprocess
|
||||
import tempfile
|
||||
import json
|
||||
import copy
|
||||
|
||||
SCRIPT_PATH = os.path.dirname(os.path.abspath(__file__))
|
||||
INPUT_SVG_DIR = os.path.join(SCRIPT_PATH, '..', '..', 'src')
|
||||
OUTPUT_FONT_DIR = os.path.join(SCRIPT_PATH, '..', '..', 'fonts')
|
||||
MANIFEST_PATH = os.path.join(SCRIPT_PATH, '..', 'manifest.json')
|
||||
BUILD_DATA_PATH = os.path.join(SCRIPT_PATH, '..', 'build_data.json')
|
||||
AUTO_WIDTH = True
|
||||
KERNING = 15
|
||||
|
||||
cp = 0xf100
|
||||
m = md5.new()
|
||||
|
||||
f = fontforge.font()
|
||||
f.encoding = 'UnicodeFull'
|
||||
f.design_size = 16
|
||||
f.em = 512
|
||||
f.ascent = 448
|
||||
f.descent = 64
|
||||
|
||||
manifest_file = open(MANIFEST_PATH, 'r')
|
||||
manifest_data = json.loads(manifest_file.read())
|
||||
manifest_file.close()
|
||||
print "Load Manifest, Icons: %s" % ( len(manifest_data['icons']) )
|
||||
|
||||
build_data = copy.deepcopy(manifest_data)
|
||||
build_data['icons'] = []
|
||||
|
||||
font_name = manifest_data['name']
|
||||
m.update(font_name + ';')
|
||||
m.update(manifest_data['prefix'] + ';')
|
||||
|
||||
for dirname, dirnames, filenames in os.walk(INPUT_SVG_DIR):
|
||||
for filename in filenames:
|
||||
name, ext = os.path.splitext(filename)
|
||||
filePath = os.path.join(dirname, filename)
|
||||
size = os.path.getsize(filePath)
|
||||
|
||||
if ext in ['.svg', '.eps']:
|
||||
|
||||
# see if this file is already in the manifest
|
||||
chr_code = None
|
||||
for ionicon in manifest_data['icons']:
|
||||
if ionicon['name'] == name:
|
||||
chr_code = ionicon['code']
|
||||
break
|
||||
|
||||
if chr_code is None:
|
||||
# this is a new src icon
|
||||
print 'New Icon: \n - %s' % (name)
|
||||
|
||||
while True:
|
||||
chr_code = '0x%x' % (cp)
|
||||
already_exists = False
|
||||
for ionicon in manifest_data['icons']:
|
||||
if ionicon.get('code') == chr_code:
|
||||
already_exists = True
|
||||
cp += 1
|
||||
chr_code = '0x%x' % (cp)
|
||||
continue
|
||||
if not already_exists:
|
||||
break
|
||||
|
||||
print ' - %s' % chr_code
|
||||
manifest_data['icons'].append({
|
||||
'name': name,
|
||||
'code': chr_code
|
||||
})
|
||||
|
||||
build_data['icons'].append({
|
||||
'name': name,
|
||||
'code': chr_code
|
||||
})
|
||||
|
||||
if ext in ['.svg']:
|
||||
# hack removal of <switch> </switch> tags
|
||||
svgfile = open(filePath, 'r+')
|
||||
tmpsvgfile = tempfile.NamedTemporaryFile(suffix=ext, delete=False)
|
||||
svgtext = svgfile.read()
|
||||
svgfile.seek(0)
|
||||
|
||||
# replace the <switch> </switch> tags with 'nothing'
|
||||
svgtext = svgtext.replace('<switch>', '')
|
||||
svgtext = svgtext.replace('</switch>', '')
|
||||
|
||||
tmpsvgfile.file.write(svgtext)
|
||||
|
||||
svgfile.close()
|
||||
tmpsvgfile.file.close()
|
||||
|
||||
filePath = tmpsvgfile.name
|
||||
# end hack
|
||||
|
||||
m.update(name + str(size) + ';')
|
||||
glyph = f.createChar( int(chr_code, 16) )
|
||||
glyph.importOutlines(filePath)
|
||||
|
||||
# if we created a temporary file, let's clean it up
|
||||
if tmpsvgfile:
|
||||
os.unlink(tmpsvgfile.name)
|
||||
|
||||
# set glyph size explicitly or automatically depending on autowidth
|
||||
if AUTO_WIDTH:
|
||||
glyph.left_side_bearing = glyph.right_side_bearing = 0
|
||||
glyph.round()
|
||||
|
||||
# resize glyphs if autowidth is enabled
|
||||
if AUTO_WIDTH:
|
||||
f.autoWidth(0, 0, 512)
|
||||
|
||||
fontfile = '%s/ionicons' % (OUTPUT_FONT_DIR)
|
||||
|
||||
build_hash = m.hexdigest()
|
||||
|
||||
if build_hash == manifest_data.get('build_hash'):
|
||||
print "Source files unchanged, did not rebuild fonts"
|
||||
|
||||
else:
|
||||
manifest_data['build_hash'] = build_hash
|
||||
|
||||
f.fontname = font_name
|
||||
f.familyname = font_name
|
||||
f.fullname = font_name
|
||||
f.generate(fontfile + '.ttf')
|
||||
f.generate(fontfile + '.svg')
|
||||
|
||||
# Fix SVG header for webkit
|
||||
# from: https://github.com/fontello/font-builder/blob/master/bin/fontconvert.py
|
||||
svgfile = open(fontfile + '.svg', 'r+')
|
||||
svgtext = svgfile.read()
|
||||
svgfile.seek(0)
|
||||
svgfile.write(svgtext.replace('''<svg>''', '''<svg xmlns="http://www.w3.org/2000/svg">'''))
|
||||
svgfile.close()
|
||||
|
||||
scriptPath = os.path.dirname(os.path.realpath(__file__))
|
||||
try:
|
||||
subprocess.Popen([scriptPath + '/sfnt2woff', fontfile + '.ttf'], stdout=subprocess.PIPE)
|
||||
except OSError:
|
||||
# If the local version of sfnt2woff fails (i.e., on Linux), try to use the
|
||||
# global version. This allows us to avoid forcing OS X users to compile
|
||||
# sfnt2woff from source, simplifying install.
|
||||
subprocess.call(['sfnt2woff', fontfile + '.ttf'])
|
||||
|
||||
# eotlitetool.py script to generate IE7-compatible .eot fonts
|
||||
subprocess.call('python ' + scriptPath + '/eotlitetool.py ' + fontfile + '.ttf -o ' + fontfile + '.eot', shell=True)
|
||||
subprocess.call('mv ' + fontfile + '.eotlite ' + fontfile + '.eot', shell=True)
|
||||
|
||||
# Hint the TTF file
|
||||
subprocess.call('ttfautohint -s -f -n ' + fontfile + '.ttf ' + fontfile + '-hinted.ttf > /dev/null 2>&1 && mv ' + fontfile + '-hinted.ttf ' + fontfile + '.ttf', shell=True)
|
||||
|
||||
manifest_data['icons'] = sorted(manifest_data['icons'], key=lambda k: k['name'])
|
||||
build_data['icons'] = sorted(build_data['icons'], key=lambda k: k['name'])
|
||||
|
||||
print "Save Manifest, Icons: %s" % ( len(manifest_data['icons']) )
|
||||
f = open(MANIFEST_PATH, 'w')
|
||||
f.write( json.dumps(manifest_data, indent=2, separators=(',', ': ')) )
|
||||
f.close()
|
||||
|
||||
print "Save Build, Icons: %s" % ( len(build_data['icons']) )
|
||||
f = open(BUILD_DATA_PATH, 'w')
|
||||
f.write( json.dumps(build_data, indent=2, separators=(',', ': ')) )
|
||||
f.close()
|
||||
|
BIN
assets/3rdparty/adminLTE/plugins/ionicons/builder/scripts/sfnt2woff
vendored
Executable file
BIN
assets/3rdparty/adminLTE/plugins/ionicons/builder/scripts/sfnt2woff
vendored
Executable file
Binary file not shown.
Reference in New Issue
Block a user