TeX-XDV-Parse

 view release on metacpan or  search on metacpan

lib/TeX/XDV/Parse.pm  view on Meta::CPAN


    # bold ?
    if ($f & XDV_FLAG_EMBOLDEN) {
        push @list,
            unpack "la*",
            pack   "La*",
            unpack "Na*",
            $buff;
        $buff = pop @list;
    }

    return @_, @list, $buff;
}

sub dir {
    my $buff = pop @_;
    my @list = unpack "Ca*", $buff;
    $buff = pop @list;
    $list[-1] = $list[-1] ? 1 : 0;  # 0=horizontal 1=vertical
    return @_, @list, $buff;
}

sub undefined_command {
    die "undefined_command: @_\n";
}

1;

__END__

=begin readme text

TeX::XDV::Parse version __VERSION__
============================

=end readme

=for install,readme stop

=head1 NAME

TeX::XDV::Parse - Perl extension for parsing TeX XDV files

=head1 SYNOPSIS

  package My_XDV_Parser;
  use TeX::XDV::Parse;
  @ISA = qw( TeX::XDV::Parse );

  sub dir {...}
  sub pic_file {...}
  sub glyph_array {...}
  sub glyph_string {...}
  sub native_font_def {...}

=for readme continue

=head1 DESCRIPTION

TeX::XDV::Parse is an extension of TeX::DVI::Parse, much as XDV is
an extension of DVI. This module simply overlays the additional XDV
functionality on top of TeX::DVI::Parse and inherits its interface.

To use, you should subclass this module and define functions to handle
each of the XDV/DVI commands. Each command will be passed the appropriate
arguments. For example:

  sub dir {
    my ($self, $opcode, $direction) = @_;
    ...
  }

The additional XDV commands are B<dir>, B<glyph_string>, B<glyph_array>,
B<pic_file>, and B<native_font_def>. Optionally, the XDV flag constants
are also available for import.

An example module, B<TeX::XDV::Print>, is available in the source
distribution package under the B<inc> directory.

See the TeX::DVI::Parse documentation for details on the DVI commands.

=for readme stop

=head1 METHODS

=head2 dir( direction )

Sets either left to right or top to bottom direction.

  0 = horizontal
  1 = vertical

=head2 pic_file( $type, $a, $b, $c, $d, $tx, $ty, $page, $len, $file )

Sets an image.

  type : file type
     a : affine transform element
     b : affine transform element
     c : affine transform element
     d : affine transform element
    tx : affine transform element
    ty : affine transform element
   len : length of filename
  page : page number
  file : filename

The affine transform takes the form

  [ a   b   0 ]
  [ c   d   0 ]
  [ tx  ty  1 ]

In general though, to transform a point (x,y):

  x' = ax + cy + tx
  y' = bx + dy + ty

=head2 glyph_string( $width, $count, $x_loc, ..., $glyph, ... )

Set a string of glyphs.



( run in 0.640 second using v1.01-cache-2.11-cpan-140bd7fdf52 )