├── 2otf.pe ├── 2svg.pe ├── 2ttf.pe ├── autohint.sh ├── convertFromScratch.sh ├── css3fonts ├── getAllFontInfo.sh ├── getFontInfo.pe ├── getFontInfo.sh ├── getFontName.pe ├── getFontWeightStyle.sh ├── license ├── minify.pe ├── readme.md ├── tableSupport.pe └── text.pe /2otf.pe: -------------------------------------------------------------------------------- 1 | Open($1) 2 | Generate($fontname + ".otf") 3 | -------------------------------------------------------------------------------- /2svg.pe: -------------------------------------------------------------------------------- 1 | Open($1) 2 | Generate($1:r + ".svg") 3 | -------------------------------------------------------------------------------- /2ttf.pe: -------------------------------------------------------------------------------- 1 | Open($1) 2 | SetFontNames($1:r,$1:r,$1:r) 3 | Generate($1:r + ".ttf") 4 | -------------------------------------------------------------------------------- /autohint.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | for i in $* 4 | do 5 | ttfautohint --strong-stem-width=D --windows-compatibility --components $i hinted-$i 6 | done 7 | -------------------------------------------------------------------------------- /convertFromScratch.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | SCRIPT_DIR=`echo $0 | sed "s/convertFromScratch.sh//"` 4 | 5 | $SCRIPT_DIR/css3fonts --clean 6 | rm hinted-*.ttf 7 | $SCRIPT_DIR/css3fonts --use-font-weight --output=weighted-stylesheet.css $* 8 | $SCRIPT_DIR/css3fonts --use-font-weight --use-font-prefix=hinted- --autohint --output=hinted-stylesheet.css *.ttf -------------------------------------------------------------------------------- /css3fonts: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | ######################################################################### 4 | # CSS3 @font-face Converter v3 5 | # by Zoltan Hawryluk (http://www.useragentman.com) 6 | # updated by Brian Gundlach (http://mrkt.ga/C) 7 | # More info available at http://mrkt.ga/F2 8 | ######################################################################### 9 | 10 | ######################################################################### 11 | ## CONFIGURATION AREA: This stuff is the only stuff you may need to # 12 | ## change. # 13 | ######################################################################### 14 | 15 | # The path should contain the directories where ttf2eot, 16 | # fontforge, ttfautohint and all the scripts in the @Font-Face Contruction Set reside. 17 | # Uncomment the line below with the right directories. Remember the 18 | # $PATH at the beginning of the string, or the script will forget what 19 | # was originally in the PATH. 20 | # PATH="$PATH:~/bin/" 21 | 22 | ######################################################################### 23 | # OPTIONS # 24 | ######################################################################### 25 | # NOTE: This requires GNU getopt. On Mac OS X and FreeBSD, you have to install this SEPARATELY 26 | # set default flags 27 | SHOW_FEATURES="0" 28 | CLEANUP="0" 29 | SHOW_HELP="0" 30 | USE_FONT_STRETCH="0" 31 | USE_FONT_WEIGHT="0" 32 | DO_AUTOHINT="0" 33 | DO_COMPRESS="0" 34 | STYLESHEETFILE='c3f.css' 35 | # read the options 36 | TEMP=`getopt -o chwsfHm::o:p: --long show-features,clean,help,autohint,minify::,output:,prefix:,stretch,weight -n 'css3fonts' -- "$@"` 37 | eval set -- "$TEMP" 38 | 39 | # extract options and their arguments into variables. 40 | while true ; do 41 | case "$1" in 42 | -m|--minify) 43 | case "$2" in 44 | "") DO_COMPRESS="1" ; shift 2 ;; 45 | *) DO_COMPRESS="$2" ; shift 2 ;; 46 | esac ;; 47 | -o|--output) STYLESHEETFILE="$2" ; shift 2 ;; 48 | -p|--prefix) FONT_PREFIX="$2" ; shift 2 ;; 49 | -c|--clean) CLEANUP="1" ; shift ;; 50 | -w|--weight) USE_FONT_WEIGHT="1" ; shift ;; 51 | -h|--help) SHOW_HELP="1" ; shift ;; 52 | -s|--stretch) USE_FONT_STRETCH="1" ; shift ;; 53 | -f|--show-features) SHOW_FEATURES="1" ; shift ;; 54 | -H|--autohint) DO_AUTOHINT="1" ; shift ;; 55 | --) shift ; break ;; 56 | *) echo "$1 is an Invalid argument!" ; exit 1 ;; 57 | esac 58 | done 59 | ARGS=`echo $* | tr ' ' ' 60 | '` 61 | echo $FONT_PREFIX 62 | 63 | ARGS=`echo "$ARGS" | grep -v '\--'` 64 | 65 | #.. is 0 if has this binary, non-zero otherwise 66 | HAS_WOFF2_COMPRESS=`which 'woff2_compress' > /dev/null; echo $?` 67 | 68 | if [ "$FONT_PREFIX" = "" -a "$DO_AUTOHINT" != "0" ] 69 | then 70 | FONT_PREFIX="hinted-" 71 | fi 72 | if [ "$FONT_PREFIX" = "" -a "$DO_COMPRESS" != "0" ] 73 | then 74 | if [ "$DO_COMPRESS" == "1" ] 75 | then 76 | FONT_PREFIX="en-" 77 | else 78 | FONT_PREFIX="h1-" 79 | fi 80 | fi 81 | 82 | #.. Before we do anything else -- make sure the args are all real files. If one 83 | # of them isn't, bail, since we don't want the output to be something 84 | # unexpected and BAD. 85 | 86 | 87 | if [ "$ARGS" = "" -a "$CLEANUP" = "0" -a "$SHOW_HELP" = "0" ] 88 | then 89 | echo 90 | echo "No arguments. Bailing." 91 | echo 92 | echo "Try '$0 --help' for instructions." 93 | echo 94 | exit 30 95 | fi 96 | 97 | for i in $ARGS 98 | do 99 | if [ ! -f $i ] 100 | then 101 | echo "One of the files you want to convert ($i) is not 102 | a file. Bailing." 1>&2 103 | exit 40 104 | fi 105 | done 106 | 107 | if [ "$HAS_WOFF2_COMPRESS" != "0" ] 108 | then 109 | echo " 110 | 111 | ********************************************************************************** 112 | * 113 | * NOTE: You either don't have woff2_compress installed on your machine 114 | * or it is not in your path. If you want WOFF2 support, please install this 115 | * application. Details on doing this available at: 116 | * 117 | * http://code.google.com/p/font-compression-reference/w/list 118 | * 119 | * (Click on the \"gathering_compression_improvement_numbers\" link). 120 | * 121 | * Not having WOFF2 support is not a show stopper, so we will continue converting 122 | * your fonts, but you can save 30-50% on a font download with browsers that do 123 | * support it, so it is highly recommended. 124 | * 125 | ********************************************************************************** 126 | 127 | " 128 | fi 129 | ######################################################################### 130 | ## PROGRAM AREA # 131 | ######################################################################### 132 | 133 | #.. check for fontforge 134 | FONTFORGE_EXT="" 135 | FONTFORGE=`which fontforge 2> /dev/null` 136 | if [ "$?" != "0" ] 137 | then 138 | FONTFORGE_EXT="bat" 139 | FONTFORGE=`which fontforge.bat 2> /dev/null` 140 | 141 | if [ "$?" != "0" ] 142 | then 143 | echo "Error: FontForge is not installed. Bailing" 1>&2 144 | exit 5 145 | fi 146 | fi 147 | 148 | SOURCE="${BASH_SOURCE[0]}" 149 | while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink 150 | TARGET="$(readlink "$SOURCE")" 151 | if [[ $SOURCE == /* ]]; then 152 | SOURCE="$TARGET" 153 | else 154 | SCRIPT_DIR="$( dirname "$SOURCE" )" 155 | SOURCE="$SCRIPT_DIR/$TARGET" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located 156 | fi 157 | done 158 | SCRIPT_DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )" 159 | IFS=$(echo -en "\n\b") 160 | 161 | 162 | if [ "$SHOW_HELP" != "0" ] 163 | then 164 | echo " 165 | CSS3 Font Converter by Brian Gundlach. 166 | Released under the WTFPL 3.0, 2015. 167 | 168 | Usage: $0 [--options] [fontfilelist] 169 | 170 | Where: - [fontfilelist] is a space separated list of ttf otf woff2 woff fonts. 171 | 172 | - [--options] are one of the following: 173 | 174 | -m --minify[=] limits the font to or A-z,0-9 and punctuation 175 | -w --weight merge font-weights and styles under same font name 176 | -s --stretch merge condensed and expanded fonts under same font name 177 | -H --autohint hint fonts 178 | -p --prefix= prepend the name of all the fonts with this string 179 | -o --output= the default output file is c3f.css 180 | -f --show-features display a list of OpenType feature tags a font supports 181 | -h --help this help menu. 182 | 183 | This script can run on any version of linux running bash and is designed to 184 | also run under Windows using Cygwin. Installation instructions and more 185 | information can be found at http://github.com/BGundlach/css3fonts or 186 | http://mrkt.ga/F2 187 | 188 | BSD derivitives (looking at you mac) may need to install the linux getopt 189 | for this script to work properly. 190 | " 191 | exit 1 192 | 193 | #.. if --show-features is set, then we just open the font file and show what 194 | # font feautres are supported by the font 195 | elif [ "$SHOW_FEATURES" != "0" ] 196 | then 197 | for i in $ARGS 198 | do 199 | echo 200 | echo "Font: $i" 201 | # echo -n "Vendor: " 202 | # $FONTFORGE -script 'showVendor.pe' 203 | $FONTFORGE -script $SCRIPT_DIR/tableSupport.pe $i 2> /dev/null | 204 | sed "s/\[//g; s/\]//g;" | tr ',' ' 205 | ' 206 | 207 | done 208 | 209 | echo 210 | echo "Information on these features can be found at these URLS: " 211 | echo " - http://www.microsoft.com/typography/otspec/featurelist.htm" 212 | echo " - http://partners.adobe.com/public/developer/opentype/index_tag3.html" 213 | echo 214 | exit 0 215 | 216 | 217 | 218 | #.. if the clean option is set, let's get rid of all files this 219 | # script may have created. 220 | elif [ "$CLEANUP" != "0" ] 221 | then 222 | 223 | echo " 224 | WARNING! This will remove all non TTF and OTF fonts, 225 | as well as hinted fonts and css stylesheets, in this directory. 226 | Are you *sure* you want to do this [y/N]?" 227 | read ANS 228 | 229 | if [ "$ANS" = "y" -o "$ANS" = "Y" ] 230 | then 231 | echo "Removing files." 232 | rm -r *.eot *.svg *.woff *.woff2 old *.css hinted-*.ttf 2> /dev/null 233 | 234 | 235 | 236 | echo "DONE" 237 | exit 20 238 | else 239 | exit 21 240 | fi 241 | 242 | 243 | #.. if the filelist contains any files prefixed with 'hinted-' and the 244 | # --autohint option is set, give an error and exit immediately. 245 | elif [ "$DO_AUTOHINT" != "0" ] 246 | then 247 | HINTED_FILES=`echo "$ARGS" | egrep "^hinted-"` 248 | 249 | if [ "$HINTED_FILES" != "" ] 250 | then 251 | echo "ERROR: Attempting to autohint already hinted files. You 252 | should only try to autohint files that haven't been hinted already. 253 | You should try to clean this directory by running this script with 254 | the --clean option. See --help for more details. Bailing. " 1>&2 255 | exit 10 256 | fi 257 | 258 | 259 | fi 260 | 261 | #.. converts a font to TTF 262 | toTTF () { 263 | if [ "$IS_WOFF" = "0" ] 264 | then 265 | woff2sfnt $i > "$FILE_STUB".otf 266 | i="$FILE_STUB".otf 267 | IS_OTF="0" 268 | fi 269 | if [ "$IS_OTF" = "0" ] 270 | then 271 | if [ "$FONTFORGE_EXT" = "bat" ] 272 | then 273 | echo "(Using MingW FontForge)" 274 | $FONTFORGE -script `cygpath -w $SCRIPT_DIR/2ttf.pe` \ 275 | `cygpath -w $i` 2> /dev/null 276 | else 277 | echo "(Using Cygwin or Unix FontForge)" 278 | $FONTFORGE -script $SCRIPT_DIR/2ttf.pe $i 279 | fi 280 | elif [ "$IS_WOFF2" = "0" ] 281 | then 282 | woff2_decompress $i 283 | i="$FILE_STUB".ttf 284 | IS_TTF="0" 285 | fi 286 | 287 | } 288 | 289 | minify () { 290 | if [ "$DO_COMPRESS" == "1" ] 291 | then 292 | $FONTFORGE -script $SCRIPT_DIR/minify.pe $i $FONT_PREFIX 293 | else 294 | TEXT_STRING="$DO_COMPRESS" 295 | LIST=() 296 | while [ ${#TEXT_STRING} -ge 1 ]; do 297 | RVSED=`echo "$TEXT_STRING" | iconv -t unicode | hexdump -ve '/1 "%02x"' | head -c 8 | tail -c 4` 298 | BYTE1=`printf $RVSED|tail -c2` 299 | BYTE2=`printf $RVSED|head -c2` 300 | CHAR=u$BYTE1$BYTE2 301 | LIST+=($CHAR) 302 | TEXT_STRING=`echo $TEXT_STRING|tail -c +2` 303 | done 304 | CHARS=($(printf '%s\n' "${LIST[@]}"|sort -u)) 305 | $FONTFORGE -script $SCRIPT_DIR/text.pe $i $FONT_PREFIX ${CHARS[@]} 306 | fi 307 | i=$FONT_PREFIX$i 308 | } 309 | 310 | #.. converts a font to EOT format. Uses EOTFAST if possible, fallbacks 311 | # to TTF2EOT otherwise. Note that that TTF2EOT is used if EOTFAST is 312 | # not installed, or if EOTFAST fails (which sometimes happens). 313 | 314 | toEOT () { 315 | which 'EOTFAST-1' > /dev/null 316 | FOUND="$?" 317 | 318 | 319 | if [ "$FOUND" = "0" -a "$USE_TTF2EOT" = "" ] 320 | then 321 | echo "(Using EOTFAST)" 322 | EOTFAST-1 $1 $FILE_STUB.eot 323 | SUCCESS="$?" 324 | 325 | if [ "$SUCCESS" != "0" ] 326 | then 327 | echo "EOTFAST failed. Using ttf2eot instead" 328 | fi 329 | fi 330 | 331 | 332 | if [ "$FOUND" != "0" -o "$SUCCESS" != "0" -o "$USE_TTF2EOT" != "" ] 333 | then 334 | echo "(Using ttf2eot)" 335 | FILE_STUB=`echo $NEW_FILE | 336 | sed "s/\.[tT][tT][fF]$//" | 337 | sed "s/\.[oO][tT][fF]$//"` 338 | ttf2eot $1 > $FILE_STUB.eot 339 | fi 340 | } 341 | 342 | #.. converts a font to SVG. Perhaps we should remove the BATIK 343 | # dependency. 344 | toSVG() { 345 | if [ -f $SCRIPT_DIR/2svg.pe ] 346 | then 347 | fontforge -script $SCRIPT_DIR/2svg.pe $1 2> /dev/null 348 | else 349 | echo "Error: cannot produce SVG font" 350 | fi 351 | } 352 | 353 | #.. This gets the font name. Used when not using the 354 | # --use-font-weight option. 355 | getFontName () { 356 | 357 | 358 | if [ "$FONTFORGE_EXT" = "bat" ] 359 | then 360 | $FONTFORGE -script `cygpath -w $SCRIPT_DIR/getFontName.pe` \ 361 | `cygpath $1` 2> /dev/null | tr ' ' '_' | 362 | sed "s/ 363 | //g" 364 | else 365 | fontforge -script $SCRIPT_DIR/getFontName.pe $1 2> /dev/null | tr ' ' '_' 366 | fi 367 | } 368 | 369 | 370 | 371 | 372 | 373 | getSVGID () { 374 | grep "id=" $1 | tr ' ' ' 375 | ' | grep ^id | awk -F'"' '{print $2}' 376 | } 377 | 378 | toWOFF () { 379 | sfnt2woff $1 380 | } 381 | 382 | toWOFF2 () { 383 | if [ "$HAS_WOFF2_COMPRESS" = "0" ] 384 | then 385 | woff2_compress $1 386 | fi 387 | } 388 | 389 | #.. This sets some (ugh) global variables with information about a font from 390 | # fontforge. 391 | getFontInfo() { 392 | OUT=`fontforge -script $SCRIPT_DIR/getFontInfo.pe $1 2> /dev/null` 393 | 394 | INFO_WEIGHT=`echo "$OUT" | egrep "^Weight:"` 395 | INFO_FONTNAME=`echo "$OUT" | egrep "^Font name:"` 396 | INFO_FULLNAME=`echo "$OUT" | egrep "^Full name:"` 397 | INFO_ITALICANGLE=`echo "$OUT" | egrep "^Italic angle:"` 398 | } 399 | 400 | #.. isWeightStyle() takes one parameter that can be one of the following: 401 | # 402 | # Bold, Italic, Condensed, Narrow 403 | # 404 | # the function will return T if it is of the type passed, F otherwise. 405 | 406 | isWeightStyle () { 407 | STYLE=`echo $1 | sed 's/ /\[ _-\]/g'` 408 | R="F" 409 | 410 | echo "$INFO_WEIGHT" | grep -i "$STYLE" > /dev/null 411 | 412 | if [ "$?" = "0" ] 413 | then 414 | R="T" 415 | else 416 | echo "$INFO_FULLNAME" | grep -i "$STYLE" > /dev/null 417 | if [ "$?" = "0" ] 418 | then 419 | R="T" 420 | else 421 | 422 | echo "$INFO_FONTNAME" | grep -i "$STYLE" > /dev/null 423 | 424 | if [ "$?" = "0" ] 425 | then 426 | R="T" 427 | fi 428 | fi 429 | fi 430 | 431 | #.. if we are testing for italic and the answer is F so far, check the 432 | # italic angle 433 | if [ "$R" = "F" -a "$STYLE" = "italic" ] 434 | then 435 | ANGLE=`echo "$INFO_ITALICANGLE" | awk -F": " '{print $2}'` 436 | 437 | if [ "$ANGLE" != "0" ] 438 | then 439 | R="T" 440 | fi 441 | fi 442 | echo $R 443 | } 444 | 445 | #.. doautohint() -- takes 1 parameter ($1) which is file that is to be hinted. 446 | # This function will write the hinted font to the same file name with the 447 | # prefix '$FONT_PREFIX'. 448 | 449 | doautohint() { 450 | 451 | if [ "$AUTOHINTER" = "ttfautohint" ] 452 | then 453 | # 454 | # These are the best options after fiddling around with this a lot. 455 | # Note that as of 0.96, the option "--components" has been replaced 456 | # by "--composites". 457 | # http://sourceforge.net/projects/freetype/files/ttfautohint/0.96/ 458 | # 459 | # Thanks to github user "pep-" for pointing this out. 460 | # 461 | 462 | if [ "$TTFAUTOHINT_096_HIGHER" = "T" ] 463 | then 464 | COMP='--composites' 465 | else 466 | COMP='--components' 467 | fi 468 | 469 | ttfautohint --strong-stem-width="" --windows-compatibility $COMP $1 $FONT_PREFIX$1 470 | else 471 | #.. The adobe autohinter spews out a lot of junk. For now, hide it. 472 | autohint -q -o $FONT_PREFIX$1 $1 2> /dev/null | grep -iv error | grep -v "^." | grep -v "^$" 473 | fi 474 | } 475 | 476 | 477 | 478 | if [ "$#" -eq "0" ] 479 | then 480 | echo "Usage: $0 " 1>&2 481 | exit 1 482 | fi 483 | 484 | # .. check to make sure all packages are installed 485 | for i in sfnt2woff java 486 | do 487 | which "$i" > /dev/null 2> /dev/null 488 | if [ "$?" != "0" ] 489 | then 490 | echo "Error: Package $i is not installed. Bailing" 1>&2 491 | exit 2 492 | fi 493 | done 494 | 495 | # .. check for ttfautohint is installed if --autohint option is set 496 | if [ "$DO_AUTOHINT" != "0" ] 497 | then 498 | which ttfautohint > /dev/null 2> /dev/null 499 | if [ "$?" != "0" ] 500 | then 501 | echo "Error: Package ttfautohint is not installed. You cannot use the 502 | --autohint option without it. Bailing. 503 | " 1>&2 504 | exit 2 505 | else 506 | #.. We will now check for the version. 507 | TTFAUTOHINT_096_HIGHER=`ttfautohint --version | 508 | grep ttfautohint | 509 | awk '{if ($2 >= 0.96) { 510 | print "T" 511 | } else { 512 | print "F" 513 | } 514 | }'` 515 | 516 | echo -n "Using version of ttfautohint >=0.96? " 517 | echo $TTFAUTOHINT_096_HIGHER 518 | fi 519 | fi 520 | 521 | 522 | 523 | 524 | #.. checks for binaries that convert to EOT format. 525 | HAS_EOT_SUPPORT=1 526 | for i in EOTFAST-1 ttf2eot 527 | do 528 | which "$i" > /dev/null 2> /dev/null 529 | HAS_EOT_SUPPORT=`expr $? \* $HAS_EOT_SUPPORT` 530 | done 531 | 532 | if [ "$HAS_EOT_SUPPORT" = "1" ] 533 | then 534 | echo "Error: EOTFAST and/or ttf2eot is not installed. Bailing." 1>&2 535 | exit 4 536 | fi 537 | 538 | if [ -d old ] 539 | then 540 | mkdir old 541 | fi 542 | 543 | #.. for each font, we create an @font-face rule. 544 | for i in $ARGS 545 | do 546 | 547 | #.. check to see if it's a TrueType font 548 | file "$i" | grep "TrueType" > /dev/null 549 | IS_TTF="$?" 550 | 551 | file "$i" | grep "Spline Font Database" > /dev/null 552 | IS_SFD="$?" 553 | 554 | file "$i" | grep "OpenType" > /dev/null 555 | IS_OTF="$?" 556 | 557 | cat "$i" | head -c 10 | grep "wOFF" > /dev/null 558 | IS_WOFF="$?" 559 | 560 | cat "$i" | head -c 10 | grep "wOF2" > /dev/null 561 | IS_WOFF2="$?" 562 | 563 | if [ "$IS_OTF" = "0" ] 564 | then 565 | ORIG_TYPE="otf" 566 | 567 | elif [ "$IS_TTF" = "0" ] 568 | then 569 | ORIG_TYPE="ttf" 570 | elif [ "$IS_WOFF" = "0" ] 571 | then 572 | ORIG_TYPE="woff" 573 | elif [ "$IS_WOFF2" = "0" ] 574 | then 575 | ORIG_TYPE="woff2" 576 | fi 577 | 578 | if [ "$DO_AUTOHINT" != "0" -a \ 579 | \( \( "$ORIG_TYPE" = "ttf" -a "$AUTOHINTER" = "autohint" \) -o \ 580 | \( "$ORIG_TYPE" = "woff" -o "$ORIG_TYPE" = "woff2" \) -o \ 581 | \( "$ORIG_TYPE" = "otf" -a "$AUTOHINTER" = "ttfautohint" \) \) ] 582 | then 583 | echo "Error! Cannot use $AUTOHINTER on $ORIG_TYPE fonts. Bailing" 1>&2 584 | exit 30 585 | fi 586 | 587 | 588 | 589 | if [ "$IS_OTF" = 0 -o "$IS_TTF" = 0 -o "$IS_WOFF" = 0 -o "$IS_WOFF2" = 0 -o "$IS_SFD" = 0 ] 590 | then 591 | 592 | cp $i old 593 | 594 | NEW_FILE=`echo $i | sed "s/ /_/g; s/TTF$/ttf/; s/OTF$/otf/; s/WOFF$/woff/; s/WOFF2$/woff2/"` 595 | 596 | if [ "$i" != "$NEW_FILE" ] 597 | then 598 | echo "Removing spaces in font name." 599 | mv $i $NEW_FILE 600 | i="$NEW_FILE" 601 | fi 602 | 603 | if [ "$FONT_PREFIX" != "" -a $DO_COMPRESS == "0" -a $DO_AUTOHINT == "0" ] 604 | then 605 | NEW_FILE=$FONT_PREFIX$NEW_FILE 606 | NEW_FILE=`echo $NEW_FILE | sed "s/ /_/g;" 607 | mv $i $NEW_FILE 608 | i="$NEW_FILE" 609 | fi 610 | 611 | FILE_STUB=`echo $NEW_FILE | 612 | sed "s/\.[to]tf$//; s/\.woff$//; s/\.woff2$//"` 613 | 614 | echo $FILE_STUB 615 | 616 | #.. If this is an OTF, WOFF or WOFF2 Font, then convert it to TTF. 617 | 618 | if [ "$IS_TTF" != "0" ] 619 | then 620 | 621 | if [ ! -f $FILE_STUB.ttf ] 622 | then 623 | toTTF $NEW_FILE 624 | fi 625 | NEW_FILE="$FILE_STUB.ttf" 626 | fi 627 | 628 | if [ "$DO_COMPRESS" != "0" ] 629 | then 630 | echo "compressing file" 631 | minify 632 | FILE_STUB="$FONT_PREFIX$FILE_STUB" 633 | NEW_FILE="$FONT_PREFIX$NEW_FILE" 634 | fi 635 | 636 | #.. If --autohint option is set, we must hint 637 | # this file with ttfautohint 638 | if [ "$DO_AUTOHINT" != "0" ] 639 | then 640 | 641 | echo "Hinting $NEW_FILE ..." 642 | doautohint $NEW_FILE 643 | FILE_STUB="$FONT_PREFIX$FILE_STUB" 644 | NEW_FILE="$FONT_PREFIX$NEW_FILE" 645 | fi 646 | 647 | 648 | 649 | if [ ! -f $FILE_STUB.eot ] 650 | then 651 | echo "Converting $FILE_STUB to eot ($NEW_FILE)" 652 | toEOT $NEW_FILE 653 | else 654 | echo "$FILE_STUB.eot exists, skipping ..." 655 | fi 656 | 657 | #.. do not convert a font to svg format if we are using 658 | # --use-font-weight, since several SVG declarations of 659 | # the same font will not work in iOS < 4.2. 660 | if [ "$USE_FONT_WEIGHT" = "0" ] 661 | then 662 | 663 | if [ ! -f $FILE_STUB.svg ] 664 | then 665 | echo "Converting $FILE_STUB to svg" 666 | toSVG $NEW_FILE $FILE_STUB 667 | else 668 | echo "$FILE_STUB.svg exists, skipping ..." 669 | fi 670 | 671 | fi 672 | 673 | if [ ! -f $FILE_STUB.woff ] 674 | then 675 | # NOTE: we use $i instead of $NEW_FILE, since woff is 676 | # just a wrapper for OTF and TTF. Having the original 677 | # OTF is better here, unless we are autohinting. 678 | if [ "$DO_AUTOHINT" != "0" ] 679 | then 680 | echo "Converting $FILE_STUB to woff from converted TTF" 681 | toWOFF $NEW_FILE 682 | else 683 | echo "Converting $FILE_STUB to woff from $i." 684 | toWOFF $i 685 | fi 686 | else 687 | echo "$FILE_STUB.woff exists, skipping ..." 688 | fi 689 | 690 | if [ ! -f $FILE_STUB.woff2 -a "$HAS_WOFF2_COMPRESS" == "0" ] 691 | then 692 | # NOTE: we use $i instead of $NEW_FILE, since woff2 is 693 | # just a wrapper for OTF and TTF. Having the original 694 | # OTF is better here, unless we are autohinting. 695 | if [ "$DO_AUTOHINT" = "0" ] 696 | then 697 | echo "Converting $FILE_STUB to woff2 from $i." 698 | toWOFF2 $i 699 | fi 700 | 701 | if [ "$?" != "0" -o "$DO_AUTOHINT" != "0" ] 702 | then 703 | echo "Converting $FILE_STUB to woff2 from converted TTF ($NEW_FILE)" 704 | toWOFF2 $NEW_FILE 705 | fi 706 | else 707 | echo "$FILE_STUB.woff2 exists, skipping ..." 708 | fi 709 | 710 | 711 | FILE_STUBS="$FILE_STUBS $FILE_STUB" 712 | else 713 | echo "File $i is not a TrueType or OpenType font. Skipping" 714 | fi 715 | done 716 | 717 | 718 | echo "Writing Stylesheet ..." 719 | 720 | COMMENT=\ 721 | "/* 722 | * This stylesheet generated by the CSS3 @font-face generator v3.0 723 | * by Brian Gundlach (http://mrkt.ga/C). 724 | * Latest version of this program is available at 725 | * https://github.com/BGundlach/css3fonts 726 | */ 727 | " 728 | 729 | echo "$COMMENT" > $STYLESHEETFILE 730 | 731 | IFS=$(echo -en " ") 732 | 733 | for i in $FILE_STUBS 734 | do 735 | 736 | 737 | if [ "$USE_FONT_WEIGHT" != "0" ] 738 | then 739 | #.. first, get the info about the font from fontforge. 740 | getFontInfo $i 741 | 742 | #.. next, from the fontforge info, find out if the font is bold, italic and/or condensed. 743 | IS_BOLD=`isWeightStyle 'bold'` 744 | IS_BLACK=`isWeightStyle 'black'` 745 | IS_LIGHT=`isWeightStyle 'light'` 746 | IS_MEDIUM=`isWeightStyle 'medium'` 747 | IS_THIN=`isWeightStyle 'thin'` 748 | IS_EXTRA_LIGHT=`isWeightStyle 'extra light'` 749 | IS_DEMI_BOLD=`isWeightStyle 'demi bold'` 750 | IS_EXTRA_BOLD=`isWeightStyle 'extra bold'` 751 | 752 | IS_ITALIC=`isWeightStyle 'italic'` 753 | 754 | IS_CONDENSED=`isWeightStyle 'condensed'` 755 | IS_EXPANDED=`isWeightStyle 'expanded'` 756 | 757 | #.. condensed and narrow are the same (I believe). 758 | if [ "$IS_CONDENSED" = "F" ] 759 | then 760 | IS_CONDENSED=`isWeightStyle 'narrow'` 761 | fi 762 | 763 | #.. set variables that will be used in the @font-face declaration 764 | # These values were grabbed from the article at 765 | # http://destination-code.blogspot.ca/2009/01/font-weight-number-keywords-100-900.html 766 | if [ "$IS_THIN" = "T" ] 767 | then 768 | FONT_WEIGHT="100"; 769 | elif [ "$IS_EXTRA_LIGHT" = "T" ] 770 | then 771 | FONT_WEIGHT="200"; 772 | elif [ "$IS_LIGHT" = "T" ] 773 | then 774 | FONT_WEIGHT="300"; 775 | elif [ "$IS_BOLD" = "T" ] 776 | then 777 | FONT_WEIGHT="700"; 778 | elif [ "$IS_MEDIUM" = "T" ] 779 | then 780 | FONT_WEIGHT="500"; 781 | elif [ "$IS_DEMI_BOLD" = "T" ] 782 | then 783 | FONT_WEIGHT="600"; 784 | elif [ "$IS_EXTRA_BOLD" = "T" ] 785 | then 786 | FONT_WEIGHT="800"; 787 | 788 | elif [ "$IS_BLACK" = "T" ] 789 | then 790 | FONT_WEIGHT="900" 791 | else 792 | FONT_WEIGHT="400"; 793 | fi 794 | 795 | if [ "$IS_ITALIC" = "T" ] 796 | then 797 | FONT_STYLE="italic"; 798 | else 799 | FONT_STYLE="normal"; 800 | fi 801 | 802 | if [ "$USE_FONT_STRETCH" != "0" ] 803 | then 804 | if [ "$IS_CONDENSED" = "T" ] 805 | then 806 | FONT_STRETCH="condensed"; 807 | elif [ "$IS_EXPANDED" = "T" ] 808 | then 809 | FONT_STRETCH="expanded"; 810 | else 811 | FONT_STRETCH="normal"; 812 | fi 813 | fi 814 | 815 | 816 | #.. the name we will refer to in CSS will be without the words "Bold", "Italic", etc. 817 | # NOTE: I Wanted to use sed with the 'gi' options, but OSX's sed (BSD 818 | # I assume) doesn't do the 'i' case insensitive switch. Boo! 819 | FONTNAME_SED_OPTIONS="s/[bB][oO][lL][dD]//g; 820 | s/[iI][tT][aA][lL][iI][cC]//g; 821 | s/[lL][iI][gG][hH][tT]//g; 822 | s/[rR][eE][gG][uU][lL][aA][rR]//g; 823 | s/[mM][eE][dD][iI][uU][mM]//g; 824 | s/[lL][iI][gG][hH][tT]//g; 825 | s/[bB][lL][aA][cC][kK]//g; 826 | s/[eE][xX][tT][rR][aA]//g; 827 | s/[dD][eE][mM][iI]//g; 828 | s/[rR][oO][mM][aA][nN]//g; 829 | s/[tT][hH][iI][nN]//g;" 830 | 831 | #.. we also remove the words "Condensed" and "Expanded" if the --use-font-stretch 832 | # option is enabled. 833 | 834 | if [ "$USE_FONT_STRETCH" != "0" ] 835 | then 836 | FONTNAME_SED_OPTIONS="$FONTNAME_SED_OPTIONS; 837 | s/[cC][oO][nN][dD][eE][nN][sS][eE][dD]//g; 838 | s/[nN][aA][rR][rR][oO][wW]//g; 839 | s/[eE][xX][pP][aA][nN][dD][eE][dD]//g;" 840 | fi 841 | 842 | #.. get rid of final "-" at the end of the font name, if it exists. 843 | FONTNAME_SED_OPTIONS="$FONTNAME_SED_OPTIONS 844 | s/-$//" 845 | 846 | FONTNAME=`echo $INFO_FONTNAME | awk -F": " '{print $2}' | 847 | sed "$FONTNAME_SED_OPTIONS" | sed "s/[-_]*$//g"` 848 | FONTNAME="$FONT_PREFIX$FILE_STUB" 849 | echo -n "Font: $FONTNAME" 850 | 851 | if [ "$FONT_STRETCH" != "normal" -a "$FONT_STRETCH" != "" ] 852 | then 853 | echo -n ", stretch: $FONT_STRETCH" 854 | fi 855 | 856 | if [ "$FONT_WEIGHT" != "normal" -a "$FONT_WEIGHT" != "" ] 857 | then 858 | echo -n ", weight: $FONT_WEIGHT" 859 | fi 860 | 861 | if [ "$FONT_STYLE" != "normal" -a "$FONT_STYLE" != "" ] 862 | then 863 | echo -n ", style: $FONT_STYLE" 864 | fi 865 | echo 866 | else 867 | FONTNAME="$FONT_PREFIX`getFontName $i.$ORIG_TYPE`" 868 | echo "Font: $FONTNAME" 869 | fi 870 | 871 | if [ "$IS_OTF" = "0" ] 872 | then 873 | EXTRA_FONT_INFO=" url('$i.otf') format('opentype'), " 874 | else 875 | EXTRA_FONT_INFO="" 876 | fi 877 | 878 | 879 | if [ "$USE_FONT_WEIGHT" != "0" ] 880 | then 881 | 882 | 883 | RULE=" 884 | @font-face { 885 | font-family: '$FONTNAME'; 886 | src: url('$i.eot?') format('eot'); 887 | src:" 888 | 889 | if [ "$HAS_WOFF2_COMPRESS" = "0" -a -f "$i.woff" ] 890 | then 891 | RULE="$RULE url('$i.woff2') format('woff2')," 892 | fi 893 | 894 | RULE="$RULE url('$i.woff') format('woff'), $EXTRA_FONT_INFO url('$i.ttf') format('truetype'); 895 | font-weight: $FONT_WEIGHT; 896 | font-style: $FONT_STYLE;" 897 | 898 | 899 | 900 | if [ "$USE_FONT_STRETCH" != "0" ] 901 | then 902 | 903 | RULE="$RULE 904 | font-stretch: $FONT_STRETCH;" 905 | 906 | fi 907 | 908 | RULE="$RULE 909 | }" 910 | 911 | echo "$RULE" >> $STYLESHEETFILE 912 | else 913 | 914 | # echo "Extracting SVG ID" 915 | SVG_ID=`getSVGID $i.svg` 916 | 917 | RULE=" 918 | @font-face { 919 | font-family: '$FONTNAME'; 920 | src: url('$i.eot?') format('eot'); 921 | src:" 922 | if [ "$HAS_WOFF2_COMPRESS" = "0" -a -f "$i.woff2" ] 923 | then 924 | RULE="$RULE url('$i.woff2') format('woff2')," >> $STYLESHEETFILE 925 | fi 926 | 927 | echo "$RULE url('$i.woff') format('woff'), url('$i.svg#$SVG_ID') format('svg'), $EXTRA_FONT_INFO url('$i.ttf') format('truetype'); 928 | }" >> $STYLESHEETFILE 929 | fi 930 | done 931 | rm old 932 | echo "DONE!" 933 | -------------------------------------------------------------------------------- /getAllFontInfo.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | for i in $1/*.ttf $1/*.otf 4 | do 5 | echo $i 6 | fontforge -script getFontInfo.pe $i 2> /dev/null 7 | echo 8 | done 9 | -------------------------------------------------------------------------------- /getFontInfo.pe: -------------------------------------------------------------------------------- 1 | Open($1) 2 | Print('Font name: ' + $fontname) 3 | Print('Full name: ' + $fullname) 4 | Print('Weight: ' + $weight) 5 | Print('Family name: ' + $familyname) 6 | Print('Fond name: ' + $fondname) 7 | Print('CID Font name: ' + $cidfontname) 8 | Print('Italic angle: ', $italicangle) 9 | Print('CID Weight: ' + $cidweight) 10 | -------------------------------------------------------------------------------- /getFontInfo.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | if [ "$#" != 1 ] 4 | then 5 | echo "Usage: $0 " 1>&2 6 | exit 1 7 | fi 8 | 9 | ISBOLD=`echo $1 | grep -i bold > /dev/null; echo $?` 10 | ISITALIC=`echo $1 | grep -i italic > /dev/null; echo $?` 11 | ISCONDENSED=`echo $1 | egrep -i 'condensed|narrow' > /dev/null; echo $?` 12 | 13 | echo $ISCONDENSED 14 | 15 | 16 | -------------------------------------------------------------------------------- /getFontName.pe: -------------------------------------------------------------------------------- 1 | Open($1) 2 | Print($fontname) 3 | -------------------------------------------------------------------------------- /getFontWeightStyle.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | SCRIPT_DIR=`echo $0 | sed "s/getFontWeightStyle.sh//"` 4 | 5 | 6 | getFontInfo() { 7 | OUT=`fontforge -script $SCRIPT_DIR/getFontInfo.pe $1 2> /dev/null` 8 | 9 | INFO_WEIGHT=`echo "$OUT" | egrep "^Weight:"` 10 | INFO_FONTNAME=`echo "$OUT" | egrep "^Font name:"` 11 | INFO_FULLNAME=`echo "$OUT" | egrep "^Full name:"` 12 | INFO_ITALICANGLE=`echo "$OUT" | egrep "^Italic angle:"` 13 | } 14 | 15 | isWeightStyle () { 16 | STYLE="$1" 17 | R="F" 18 | 19 | echo "$INFO_WEIGHT" | grep -i $STYLE > /dev/null 20 | 21 | if [ "$?" = "0" ] 22 | then 23 | R="T" 24 | else 25 | echo "$INFO_FULLNAME" | grep -i $STYLE > /dev/null 26 | if [ "$?" = "0" ] 27 | then 28 | R="T" 29 | else 30 | 31 | echo "$INFO_FONTNAME" | grep -i $STYLE > /dev/null 32 | 33 | if [ "$?" = "0" ] 34 | then 35 | R="T" 36 | fi 37 | fi 38 | fi 39 | 40 | #.. if we are testing for italic and the answer is F so far, check the 41 | # italic angle 42 | if [ "$R" = "F" -a "$STYLE" = "italic" ] 43 | then 44 | ANGLE=`echo "$INFO_ITALICANGLE" | awk -F": " '{print $2}'` 45 | 46 | if [ "$ANGLE" != "0" ] 47 | then 48 | R="T" 49 | fi 50 | fi 51 | echo $R 52 | } 53 | 54 | #.. first, get the info about the font from fontforge. 55 | getFontInfo $1 56 | 57 | #.. next, from the fontforge info, find out if the font is bold, italic and/or condensed. 58 | IS_BOLD=`isWeightStyle 'bold'` 59 | IS_ITALIC=`isWeightStyle 'italic'` 60 | IS_CONDENSED=`isWeightStyle 'condensed'` 61 | 62 | #.. condensed and narrow are the same (I believe). 63 | if [ "$IS_CONDENSED" = "F" ] 64 | then 65 | IS_CONDENSED=`isWeightStyle 'narrow'` 66 | fi 67 | 68 | #.. the name we will refer to in CSS will be without the words "Bold", "Italic", etc. 69 | NEW_NAME=`echo $INFO_FONTNAME | awk -F": " '{print $2}' | 70 | sed 's/Bold//gi; 71 | s/Italic//gi; 72 | s/Narrow//gi; 73 | s/Condensed//gi; 74 | s/Regular//gi; 75 | s/-$//' ` 76 | 77 | echo 78 | echo "$OUT" 79 | echo "===============" 80 | 81 | 82 | echo "CSS Name: $NEW_NAME" 83 | echo "IS BOLD: $IS_BOLD" 84 | echo "IS ITALIC: $IS_ITALIC" 85 | echo "IS CONDENSED: $IS_CONDENSED" 86 | -------------------------------------------------------------------------------- /license: -------------------------------------------------------------------------------- 1 | "DO WHATEVER THE FUCK YOU WANT" PUBLIC LICENSE 2 | Version 3, December 2004 3 | 4 | Copyright (C) 2015 Brian Gundlach 5 | 6 | Everyone is permitted to copy and distribute verbatim or modified. 7 | This licence is licensed under this license 8 | 9 | "DO WHATEVER THE FUCK YOU WANT" PUBLIC LICENSE 10 | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 11 | 12 | 0. You just DO WHATEVER THE FUCK YOU WANT. -------------------------------------------------------------------------------- /minify.pe: -------------------------------------------------------------------------------- 1 | #!/usr/bin/fontforge 2 | Open($1) 3 | Select(0u20,0ua9) 4 | SelectMoreSingletons(0ua,0ud) 5 | SelectInvert() 6 | DetachAndRemoveGlyphs() 7 | Reencode("compacted") 8 | Generate($2+$1:r+".ttf") 9 | Generate($2+$1:r+".svg") -------------------------------------------------------------------------------- /readme.md: -------------------------------------------------------------------------------- 1 | # css3fonts 2 | 3 | QUICK START GUIDE: 4 | ------------------ 5 | 6 | This CSS3 Font Converter is a shell script that allows developers, using a 7 | command line, to convert a set of fonts, TTF/OTF/WOFF/WOFF2 into all the other 8 | currently used CSS3 @font-face formats (i.e. EOT, SVG, WOFF, WOFF2). 9 | Syntax: 10 | 11 | css3fonts 12 | 13 | For example, if you wanted to convert all the ttf files in your projects fonts folder and output the stylesheet to your scss folder, In your project base you could type in the command: 14 | 15 | $ css3fonts fonts/*.ttf --prefix="ProjectName" -o scss/_fonts.scss 16 | 17 | The fonts will then be converted to the .eot, .woff, and .svg formats. It 18 | will also generate a stylesheet, stylesheet.css, that will produce the 19 | @font-face rules using The New Bulletproof @Font-Face Syntax. 20 | 21 | If you are converting .otf fonts or .woff2, a .ttf font will be generated first before 22 | the other fonts. If you are converting .woff, it will first convert to .otf, then ttf. 23 | 24 | 25 | FULL COMMAND LINE OPTIONS: 26 | --------------------------- 27 | ``` 28 | Usage: $0 [--options] [fontfilelist] 29 | 30 | Where: - [fontfilelist] is a space separated list of ttf otf woff2 woff fonts. 31 | 32 | - [--options] are one of the following: 33 | 34 | -m --minify[=] limits the font to or A-z,0-9 and punctuation 35 | -w --weight merge font-weights and styles under same font name 36 | -s --stretch merge condensed and expanded fonts under same font name 37 | -H --autohint hint fonts 38 | -p --prefix= prepend the name of all the fonts with this string 39 | -o --output= the default output file is c3f.css 40 | -f --show-features display a list of OpenType feature tags a font supports 41 | -h --help this help menu. 42 | 43 | This script can run on any version of linux running bash and is designed to 44 | also run under Windows using Cygwin. Installation instructions and more 45 | information can be found at http://github.com/BGundlach/css3Fonts or 46 | http://mrkt.ga/F2 47 | 48 | BSD derivitives (looking at you mac) may need to install the linux getopt 49 | for this script to work properly. 50 | ``` 51 | 52 | SUPPORTED OSes: 53 | --------------- 54 | 55 | Windows (using Cygwin), OS X and Linux (tested on Ubuntu 10.10 Maverick 56 | Meerkat and crunchbang 11 waldorf). Please let us know if you find it works on others. 57 | 58 | This script should run on any version of UNIX running bash. 59 | Installation instructions and more information can be found at [Gundlach Marketing](http://gundlach-marketing.com/blog/create-webfont-css-kits-from-your-command-line "webfonts from your command line") 60 | 61 | 62 | REQUIREMENTS: 63 | ------------- 64 | 65 | This script uses the following programs to do the heavy listing. 66 | - Fontforge: [http://fontforge.sourceforge.net/](http://fontforge.sourceforge.net/) 67 | - ttf2eot: [http://www.npmjs.com/package/ttf2eot](http://www.npmjs.com/package/ttf2eot) 68 | - sfnt2woff: [http://people.mozilla.com/~jkew/woff/](http://people.mozilla.com/~jkew/woff/) 69 | - woff2sfnt: [http://people.mozilla.com/~jkew/woff/](http://people.mozilla.com/~jkew/woff/) 70 | - ttfautohint: [http://www.freetype.org/ttfautohint/](http://www.freetype.org/ttfautohint/) 71 | - woff2_compress: [http://code.google.com/p/font-compression-reference/w/list](http://code.google.com/p/font-compression-reference/w/list) 72 | - woff2_decompress: [http://code.google.com/p/font-compression-reference/w/list](http://code.google.com/p/font-compression-reference/w/list) 73 | - EOTFAST: [http://eotfast.com/ *windows only*](http://eotfast.com/) 74 | 75 | INSTALLATION: 76 | ------------- 77 | 78 | The below commands will install the necessary dependencies on debian or ubuntu as well as the css3fonts script. 79 | 80 | I'm assuming you have git and [node.js](http://nodejs.org) installed (if not, install node now). You can add git to the end of the first command if you don't have it already. 81 | 82 | ```bash 83 | sudo apt-get install ttfautohint fontforge # git if you don't have it 84 | sudo npm install -g ttf2eot # need node for this 85 | ``` 86 | 87 | 88 | ``` 89 | mkdir ~/bin/sfnt2woff-src 90 | wget http://people.mozilla.org/~jkew/woff/woff-code-latest.zip 91 | unzip woff-code-latest -d ~/bin/sfnt2woff-src 92 | rm woff-code-latest.zip 93 | cd ~/bin/sfnt2woff-src 94 | make 95 | cp sfnt2woff woff2sfnt ../ 96 | git clone https://github.com/google/woff2.git 97 | cd woff2 98 | git submodule init 99 | git submodule update 100 | make clean all 101 | cp woff2_compress woff2_decompress ../ 102 | cd ../ 103 | git clone https://github.com/BGundlach/css3Fonts.git 104 | ln -sT css3Fonts/css3fonts ~/bin/css3fonts 105 | rm -r sfnt2woff-src woff2 106 | 107 | ``` 108 | 109 | LICENSE: 110 | -------- 111 | 112 | This code is released under the WTFPL 3.0. License can be found in the license file. It is based off of 113 | [Sam Hocevar's WTFPL](http://wtfpl.net) 114 | 115 | CHANGELOG: 116 | ---------- 117 | 118 | ### Authored By Zoltan 119 | 120 | Feb 20, 2011 - Initial Release 121 | 122 | Sep 22, 2013 - Added support for font-weight and autohinting, as well as reporting what font-feature-support tags (i.e. OpenType feature tags) are implemented by a font. 123 | 124 | Sep 02, 2014 - Added support for WOFF2 fonts, if woff2_compress is in the user's path. This program can be retrieved from here: http://code.google.com/p/font-compression-reference/w/list 125 | 126 | ### Authored By Brian 127 | 128 | Jan 24, 2015 - Added symlink frindly code as well as a debian install script and updated ttf2eot to the maintained node module 129 | 130 | Jan 25, 2015 - Added support for woff and woff2 fonts as valid input. 131 | 132 | Feb 3, 2015 - Added "--minify" option & associated capabilities. 133 | 134 | CONTACT: 135 | -------- 136 | 137 | Any bug reports, fixes or feature requests should be posted to the github repo at [https://github.com/BGundlach/css3Fonts](https://github.com/BGundlach/css3Fonts "css3fonts") 138 | 139 | If you think this script is pretty slick and want to hire me as a front end developer, contact me at GundlachWebDesign@gmail.com 140 | -------------------------------------------------------------------------------- /tableSupport.pe: -------------------------------------------------------------------------------- 1 | Open($1); 2 | gpos = GetLookups("gpos"); 3 | gsub = GetLookups("gsub"); 4 | 5 | Print(gpos); 6 | Print(gsub); -------------------------------------------------------------------------------- /text.pe: -------------------------------------------------------------------------------- 1 | #!/usr/bin/fontforge 2 | Open($1) 3 | Select($3) 4 | i=4 5 | while ( i<$argc ) 6 | SelectMore($argv[i]) 7 | i = i+1 8 | endloop 9 | SelectInvert() 10 | DetachAndRemoveGlyphs() 11 | Reencode("compacted") 12 | Generate($2+$1:r+".ttf") 13 | Generate($2+$1:r+".svg") --------------------------------------------------------------------------------