Changeset 72f37d2 in git


Ignore:
Timestamp:
15/06/10 08:44:19 (9 years ago)
Author:
Olly Betts <olly@…>
Branches:
add-show-splays, line_contents, master, stereo, svn/github/master, svn/origin/master, svn/survex-1_1, svn/tags/1.1.14, svn/tags/1.1.15, svn/tags/1.1.16, svn/tags/1.2.0, svn/tags/1.2.1, svn/tags/1.2.2, svn/tags/1.2.3, svn/tags/1.2.4, svn/tags/1.2.5, svn/tags/v1_1_13, svn/trunk, travis-osx
Children:
d133b65
Parents:
7c7cffd
Message:

lib/afm2txf.pl: Add support for -o option to specify output .txf
file.

git-svn-id: file:///home/survex-svn/survex/branches/survex-1_1@3412 4b37db11-9a0c-4f06-9ece-9ab7cdaee568

Files:
2 edited

Legend:

Unmodified
Added
Removed
  • ChangeLog

    r7c7cffd r72f37d2  
     1Tue Jun 15 07:43:48 GMT 2010  Olly Betts <olly@survex.com>
     2
     3        * lib/afm2txf.pl: Add support for -o option to specify output .txf
     4          file.
     5
    16Tue Jun 15 07:10:16 GMT 2010  Olly Betts <olly@survex.com>
    27
  • lib/afm2txf.pl

    r7c7cffd r72f37d2  
    77#
    88# Usage:
    9 #       afm2txf.pl whatever.afm
     9#       afm2txf.pl [-o OUTPUT.txf] whatever.afm
    1010#
    1111# Changelog:
     
    2121
    2222use strict;
     23
     24my $output;
     25if (scalar @ARGV >= 1) {
     26    my $arg = $ARGV[0];
     27    if ($arg =~ s/^-o//) {
     28        shift;
     29        if ($arg eq '') {
     30            if (scalar @ARGV == 0) {
     31                die "-o needs an argument\n";
     32            }
     33            $output = shift;
     34        } else {
     35            $output = $arg;
     36        }
     37    }
     38}
    2339
    2440my $METRICS = shift or die; # AFM file
     
    186202
    187203sub round { sprintf "%.0f", $_[0] }
    188 open TXF, ">$FONT.txf" or die;
     204$output = "$FONT.txf" unless defined $output;
     205open TXF, '>', $output or die;
    189206print TXF pack "V", 0x667874ff;
    190207print TXF pack "V", 0x12345678;
Note: See TracChangeset for help on using the changeset viewer.