microsoft / Font-Validator

Font Validator is a tool for testing fonts prior to release. This testing ensures that fonts meet Microsoft's high quality standards and perform exceptionally well on Microsoft's platform.
Other
117 stars 41 forks source link

Shell script for easy commandline use on Mac OS X #4

Open twardoch opened 9 years ago

twardoch commented 9 years ago

This is a small shell script that you can use to run Font Validator from Terminal on Mac OS X. In my case, I put the FontValidator binaries into the /usr/local/mono/fontval folder. You can put it anywhere, but make sure to update the line starting with export FVALDIR to point to that location. You can copy-paste the code below into a plain-text file and proceed as described below. Make sure that the line #!/usr/bin/env bash is the very first line in the file (no blank lines above).

#!/usr/bin/env bash
# Use https://github.com/HinTak/Font-Validator
# or http://sourceforge.net/projects/hp-pxl-jetready/files/private-test-data/FontVal-RELEASE_2015_11_12-bin.zip/download
# on Mac OS X
# 
# INSTALL
#1. Install http://brew.sh/
#2. Run: brew install mono
#3. Run: brew install freetype
#4. Change line 5 of SharpFont.dll.config to: 
# <dllentry os="osx" dll="/usr/local/lib/libfreetype.6.dylib" />
#5. Here, set the folder in which FontValidator.exe and fval.xsl can be found:
export FVALDIR=/usr/local/mono/fontval
#6. Save this file as /usr/local/bin/fontval and do `chmod gou+x /usr/local/bin/fontval`
# 
# RUN
# Run this as fontval myfont1.ttf myfont2.ttf...
for p in "$@"
do
  echo "Validating $p..."
  # This runs FontValidator.exe via mono and outputs the XML report into the same folder as the font
  mono "$FVALDIR/FontValidator.exe" -file "$p" -quiet -report-in-font-dir
  # This converts the XML report into HTML and opens it, removing the XML report
  xsltproc --output "$p.fval.html" "$FVALDIR/fval.xsl" "$p.report.xml"
  rm "$p.report.xml"
  open "$p.fval.html"
done
anthrotype commented 9 years ago

:+1:

HinTak commented 9 years ago

Thanks! This probably belongs to the wiki, or go into a 'helper-script' directory?

aaronbell commented 9 years ago

Hi Adam! This is great. I think this should probably go into a helper-script directory with points from the Wiki / Readme. Awesome!

twardoch commented 9 years ago

Helper-script is better. I'll probably contribute some simple Python stuff as well, for easy integration with font editors. I'll fork and put the code myself, then issue a pull request (it's about time I do my first Github pull request ever ;)

A.

Sent from my mobile phone.

On 16.11.2015, at 19:04, Aaron notifications@github.com wrote:

Hi Adam! This is great. I think this should probably go into a helper-script directory with points from the Wiki / Readme. Awesome!

— Reply to this email directly or view it on GitHub.

HinTak commented 9 years ago

I would put it under contrib/OSX/ as helper-script or something like that; some of the information in the script could go onto a wiki (and not just linked from a wiki). I suggest that you put some minimal "boiler plate" stuff at the top with e.g. your name & license as per usual practice of such scripts that are contributed to be included.

HinTak commented 8 years ago

I have just made a change: https://github.com/HinTak/Font-Validator/commit/8a7c17192da41cf6b8b17b0578964240d3cc70a8 to auto-generate html on non-windows, so the xsltproc line is no longer needed.

It is a code sniplet that has been sitting in my dev area for a while - I just wasn't too sure if I want to add it. The html version does not give any new info, but mainly needed only because built-in xml viewing does not work. Therefore it might be a better idea to get report viewing working on all platforms. at the moment it is enabled for all non-windows, but I might make it optional later.

HinTak commented 8 years ago

Actually the command line tool no longer needs mono to run:

http://typedrawers.com/discussion/1314/microsoft-font-validator-runs-native-on-mac-os-x

HinTak commented 8 years ago

And the GUI works independently now too... Just duplicating my posting...


Okay, no more messing with command lines or environment variables. New mac os "FontVal-*.dmg" disk image:

http://sourceforge.net/projects/hp-pxl-jetready/files/Microsoft Font Validator/

You just download, double click to open the disk image, which contains exactly one icon to click. You double-click that, it launches the GUI !

I feel that I should get some donation on this, so please do make one ( http://sourceforge.net/p/hp-pxl-jetready/donate/) if you find this neat .