App-FontUtils

 view release on metacpan or  search on metacpan

META.json  view on Meta::CPAN

{
   "abstract" : "Command-line utilities related to fonts and font files",
   "author" : [
      "perlancar <perlancar@cpan.org>"
   ],
   "dynamic_config" : 0,
   "generated_by" : "Dist::Zilla version 6.024, CPAN::Meta::Converter version 2.150010",
   "license" : [
      "perl_5"
   ],
   "meta-spec" : {
      "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec",

META.yml  view on Meta::CPAN

---
abstract: 'Command-line utilities related to fonts and font files'
author:
  - 'perlancar <perlancar@cpan.org>'
build_requires:
  File::Spec: '0'
  IO::Handle: '0'
  IPC::Open3: '0'
  Test::More: '0'
configure_requires:
  ExtUtils::MakeMaker: '0'
dynamic_config: 0

Makefile.PL  view on Meta::CPAN

# This file was automatically generated by Dist::Zilla::Plugin::MakeMaker v6.024.
use strict;
use warnings;

use 5.010001;

use ExtUtils::MakeMaker;

my %WriteMakefileArgs = (
  "ABSTRACT" => "Command-line utilities related to fonts and font files",
  "AUTHOR" => "perlancar <perlancar\@cpan.org>",
  "CONFIGURE_REQUIRES" => {
    "ExtUtils::MakeMaker" => 0
  },
  "DISTNAME" => "App-FontUtils",
  "EXE_FILES" => [
    "script/otf2ttf",
    "script/ttf2otf"
  ],
  "LICENSE" => "perl",

README  view on Meta::CPAN

NAME
    App::FontUtils - Command-line utilities related to fonts and font files

VERSION
    This document describes version 0.002 of App::FontUtils (from Perl
    distribution App-FontUtils), released on 2022-08-30.

SYNOPSIS
    This distribution provides tha following command-line utilities related
    to fonts and font files:

    *   otf2ttf

    *   ttf2otf

FUNCTIONS
  otf2ttf
    Usage:

     otf2ttf(%args) -> [$status_code, $reason, $payload, \%result_meta]

    Convert OTF to TTF.

    This program is a shortcut wrapper for fontforge. This command:

     % otf2ttf foo.otf

    is equivalent to:

     % fontforge -lang=ff -c 'Open($1); Generate($2); Close();' foo.otf foo.ttf

    This function is not exported.

    Arguments ('*' denotes required arguments):

    *   otf_file* => *filename*

    *   overwrite => *bool*

    *   ttf_file => *filename*

README  view on Meta::CPAN


    Return value: (any)

  ttf2otf
    Usage:

     ttf2otf(%args) -> [$status_code, $reason, $payload, \%result_meta]

    Convert TTF to OTF.

    This program is a shortcut wrapper for fontforge. This command:

     % ttf2otf foo.ttf

    is equivalent to:

     % fontforge -lang=ff -c 'Open($1); Generate($2); Close();' foo.ttf foo.otf

    This function is not exported.

    Arguments ('*' denotes required arguments):

    *   otf_file => *filename*

    *   overwrite => *bool*

    *   ttf_file* => *filename*

README  view on Meta::CPAN

    like "OK" if status is 200. Third element ($payload) is the actual
    result, but usually not present when enveloped result is an error
    response ($status_code is not 2xx). Fourth element (%result_meta) is
    called result metadata and is optional, a hash that contains extra
    information, much like how HTTP response headers provide additional
    metadata.

    Return value: (any)

TODO
    "list-fonts" to list installed fonts on the system (in a cross-platform
    way). Tab completion. Filtering OTF/TTF, etc.

    "show-fonts <font names> [text]" to show how fonts look. Allow
    specifying wildcards. Allow specifying filename for source of text. Tab
    completion.

    "install-font <font files>" and "uninstall-font <font names>" to install
    and uninstall fonts (in a cross-platform way). Allow specifying
    regex/wildcard in uninstall. Tab completion.

    "<search-font">

HOMEPAGE
    Please visit the project's homepage at
    <https://metacpan.org/release/App-FontUtils>.

SOURCE
    Source repository is at
    <https://github.com/perlancar/perl-App-FontUtils>.

SEE ALSO

lib/App/FontUtils.pm  view on Meta::CPAN

        schema => 'bool*',
        cmdline_aliases => {O=>{}},
    },
);

$SPEC{ttf2otf} = {
    v => 1.1,
    summary => 'Convert TTF to OTF',
    description => <<'_',

This program is a shortcut wrapper for <prog:fontforge>. This command:

    % ttf2otf foo.ttf

is equivalent to:

    % fontforge -lang=ff -c 'Open($1); Generate($2); Close();' foo.ttf foo.otf

_
    args => {
        %argspec0_ttf_file,
        %argspec1opt_otf_file,
        %argspecopt_overwrite,
    },
    deps => {
        prog => 'fontforge',
    },
    links => [
        {url => 'prog:otf2ttf'},
    ],
};
sub ttf2otf {
    require IPC::System::Options;

    my %args = @_;

lib/App/FontUtils.pm  view on Meta::CPAN


    my $otf_file = $args{otf_file};
    unless (defined $otf_file) {
        ($otf_file = $ttf_file) =~ s/\.ttf\z/.otf/i;
    }
    $otf_file eq $ttf_file and return [412, "Please specify a different name for the output OTF file"];
    ((-f $otf_file) && !$args{overwrite}) and return [412, "OTF file '$otf_file' already exists, please specify another output name or use --overwrite"];

    IPC::System::Options::system(
        {log=>1, die=>1},
        "fontforge", "-lang=ff", "-c", 'Open($1); Generate($2); Close();', $ttf_file, $otf_file,
    );
    [200];
}

$SPEC{otf2ttf} = {
    v => 1.1,
    summary => 'Convert OTF to TTF',
    description => <<'_',

This program is a shortcut wrapper for <prog:fontforge>. This command:

    % otf2ttf foo.otf

is equivalent to:

    % fontforge -lang=ff -c 'Open($1); Generate($2); Close();' foo.otf foo.ttf

_
    args => {
        %argspec0_otf_file,
        %argspec1opt_ttf_file,
        %argspecopt_overwrite,
    },
    deps => {
        prog => 'fontforge',
    },
    links => [
        {url => 'prog:ttf2otf'},
    ],
};
sub otf2ttf {
    require IPC::System::Options;

    my %args = @_;

lib/App/FontUtils.pm  view on Meta::CPAN


    my $ttf_file = $args{ttf_file};
    unless (defined $ttf_file) {
        ($ttf_file = $otf_file) =~ s/\.otf\z/.ttf/i;
    }
    $ttf_file eq $otf_file and return [412, "Please specify a different name for the output TTF file"];
    ((-f $ttf_file) && !$args{overwrite}) and return [412, "TTF file '$ttf_file' already exists, please specify another output name or use --overwrite"];

    IPC::System::Options::system(
        {log=>1, die=>1},
        "fontforge", "-lang=ff", "-c", 'Open($1); Generate($2); Close();', $otf_file, $ttf_file,
    );
    [200];
}

1;
# ABSTRACT: Command-line utilities related to fonts and font files

__END__

=pod

=encoding UTF-8

=head1 NAME

App::FontUtils - Command-line utilities related to fonts and font files

=head1 VERSION

This document describes version 0.002 of App::FontUtils (from Perl distribution App-FontUtils), released on 2022-08-30.

=head1 SYNOPSIS

This distribution provides tha following command-line utilities related to fonts
and font files:

=over

=item * L<otf2ttf>

=item * L<ttf2otf>

=back

=head1 FUNCTIONS


=head2 otf2ttf

Usage:

 otf2ttf(%args) -> [$status_code, $reason, $payload, \%result_meta]

Convert OTF to TTF.

This program is a shortcut wrapper for L<fontforge>. This command:

 % otf2ttf foo.otf

is equivalent to:

 % fontforge -lang=ff -c 'Open($1); Generate($2); Close();' foo.otf foo.ttf

This function is not exported.

Arguments ('*' denotes required arguments):

=over 4

=item * B<otf_file>* => I<filename>

=item * B<overwrite> => I<bool>

lib/App/FontUtils.pm  view on Meta::CPAN



=head2 ttf2otf

Usage:

 ttf2otf(%args) -> [$status_code, $reason, $payload, \%result_meta]

Convert TTF to OTF.

This program is a shortcut wrapper for L<fontforge>. This command:

 % ttf2otf foo.ttf

is equivalent to:

 % fontforge -lang=ff -c 'Open($1); Generate($2); Close();' foo.ttf foo.otf

This function is not exported.

Arguments ('*' denotes required arguments):

=over 4

=item * B<otf_file> => I<filename>

=item * B<overwrite> => I<bool>

lib/App/FontUtils.pm  view on Meta::CPAN

(200 means OK, 4xx caller error, 5xx function error). Second element
($reason) is a string containing error message, or something like "OK" if status is
200. Third element ($payload) is the actual result, but usually not present when enveloped result is an error response ($status_code is not 2xx). Fourth
element (%result_meta) is called result metadata and is optional, a hash
that contains extra information, much like how HTTP response headers provide additional metadata.

Return value:  (any)

=head1 TODO

C<list-fonts> to list installed fonts on the system (in a cross-platform way).
Tab completion. Filtering OTF/TTF, etc.

C<< show-fonts <font names> [text] >> to show how fonts look. Allow specifying
wildcards. Allow specifying filename for source of text. Tab completion.

C<< install-font <font files> >> and C<< uninstall-font <font names> >> to
install and uninstall fonts (in a cross-platform way). Allow specifying
regex/wildcard in uninstall. Tab completion.

C<<search-font>>

=head1 HOMEPAGE

Please visit the project's homepage at L<https://metacpan.org/release/App-FontUtils>.

=head1 SOURCE

Source repository is at L<https://github.com/perlancar/perl-App-FontUtils>.

=head1 SEE ALSO

script/otf2ttf  view on Meta::CPAN

=head1 VERSION

This document describes version 0.002 of otf2ttf (from Perl distribution App-FontUtils), released on 2022-08-30.

=head1 SYNOPSIS

B<otf2ttf> [B<--debug>|B<--log-level>=I<level>|B<--quiet>|B<--trace>|B<--verbose>] [B<--format>=I<name>|B<--json>] [B<--(no)naked-res>] [B<--overwrite>|B<-O>|B<--no-overwrite>|B<--nooverwrite>] [B<--page-result>[=I<program>]|B<--view-result>[=I<progr...

=head1 DESCRIPTION

This program is a shortcut wrapper for L<fontforge>. This command:

 % otf2ttf foo.otf

is equivalent to:

 % fontforge -lang=ff -c 'Open($1); Generate($2); Close();' foo.otf foo.ttf

=head1 OPTIONS

C<*> marks required options.

=head2 Main options

=over

=item B<--otf-file>=I<s>*

script/ttf2otf  view on Meta::CPAN

=head1 VERSION

This document describes version 0.002 of ttf2otf (from Perl distribution App-FontUtils), released on 2022-08-30.

=head1 SYNOPSIS

B<ttf2otf> [B<--debug>|B<--log-level>=I<level>|B<--quiet>|B<--trace>|B<--verbose>] [B<--format>=I<name>|B<--json>] [B<--(no)naked-res>] [B<--overwrite>|B<-O>|B<--no-overwrite>|B<--nooverwrite>] [B<--page-result>[=I<program>]|B<--view-result>[=I<progr...

=head1 DESCRIPTION

This program is a shortcut wrapper for L<fontforge>. This command:

 % ttf2otf foo.ttf

is equivalent to:

 % fontforge -lang=ff -c 'Open($1); Generate($2); Close();' foo.ttf foo.otf

=head1 OPTIONS

C<*> marks required options.

=head2 Main options

=over

=item B<--otf-file>=I<s>



( run in 1.738 second using v1.01-cache-2.11-cpan-5735350b133 )