Korea FreeBSD Users Group News, Internal, Projects, Home
Software, Support, Documentation

Re: Re: X¿¡¼­ Æ®·çŸÀÔ ÆùÆ® ¾²±â Áú¹®..



[ ³¯Â¥¼ø »öÀÎ ] [ ´ñ±Û¼ø »öÀÎ ] [ ÃÖ»óÀ§ »öÀÎ]

[ÀÌÀü ±Û] [´ÙÀ½ ±Û] [ÀÌÀü ´ñ±Û] [´ÙÀ½ ´ñ±Û]


>>>>> "SL" == Steve Lee <wincom@aunet.ne.kr> writes:

    SL> ÂÁ...  ¹Ø¿¡ º¸³½ ¸ÞÀÏ ÀÎÄÚµùÀ» À߸øÇؼ­ ÁË´Ù ±úÁ³±º¿ä.. Á˼ÛÇÕ´Ï´Ù....

    SL>  ÃÖÁØÈ£´Ô °¨»çÇÕ´Ï´Ù.  ÇÏÁö¸¸ ¹°·Ð  X¸¦ ´Ù½Ã ½ÇÇà½ÃÄ×ÁÒ.. ^^;
    SL>  ¹®Á¦´Â Á¦°¡ fonts.dir¸¦ ¸¸µç´Ù´Â °ÍÀ» font.dir·Î À߸ø¸¸µé¾ú±â
    SL> ¶§¹®À̾ú½À´Ï´Ù. -_-;

    SL>  Àß ³ª¿À´Â °Å °°Àºµ¥..  ¿Ö ³Ý½ºÄÉÀÌÇÁ¿¡¼­ ±¼¸² ÆùÆ®¸¦ 12ÆùÆ®¸¸
    SL> Áö¿øÇÏ´ÂÁö ±Ã±ÝÇϱº¿ä..
    SL>  Æ®·çŸÀÔÀÌ¸é ÆùÆ® Å©±â¸¦ Á¶ÀýÇÒ ¼ö ÀÖ´Â °Å ¾Æ´Ñ°¡¿ä?(¾Æ´Ñ°¡?)

±×·¡¾ß ÇϰÚÁö¸¸ ½ÇÁ¦·Î ±×·¸Áö ¾Ê½À´Ï´Ù :<

´ÙÀ½ ½ºÅ©¸³Æ®¸¦ »ç¿ëÇØ º¸¼¼¿ä. Á¦°¡ §°Ç ¾Æ´Ï°í X-TT 1.2¿¡ µé¾îÀÖ´Â °Ì´Ï´Ù.
»ç¿ë¹ýÀº... fonts.dirÀÌ ÀÖ´Â µð·ºÅ丮¿¡¿¡¼­ ¾²¸é fonts.alias¿¡ Ãß°¡ÇÒ
°ÍÀ» ¸¸µé¾î ÁÙ °Ì´Ï´Ù.

#! /usr/local/bin/perl

#
# make aliases for netscape navigator from fonts.dir
#

require "newgetopt.pl";

my ($default_pixel) = 20;
my ($default_res) = 75;

sub parse_pixel($$$)
{
    my ($str, $rPixel, $rRes) = @_;
    
    $$rPixel = $default_pixel;
    $$rRes = $default_res;
    if ($str =~ m,^(\d+):(\d+)$,) {
        $$rPixel = $1;
        $$rRes = $2;
    } elsif ($str =~ m,^(\d+)$,) {
        $$rPixel = $1;
    } elsif ($str =~ m,^:(\d+)$,) {
        $$rRes = $1;
    } else {
        return 0;
    }
    
    return 1;
}


sub usage
{
    $0 =~ m,[^/]*$,;
    printf STDERR
        "usage: %s [options] size [size [...] ]\n",
        $&;
    print STDERR "  size syntax:\n";
    print STDERR "    pixel              - e.g. 12\n";
    print STDERR "    :resolution        - e.g. :75\n";
    print STDERR "    pixel:resolution   - e.g. 12:75\n";
    print STDERR "  options:\n";
    print STDERR "    -h|-help        print this message.\n";
    print STDERR "    -p|-pixel       default pixel size.  default=$default_pixel\n";
    print STDERR "    -r|-resolution  default resolution.  default=$default_res\n";
    print STDERR "    -i|-infile      input file.          default=STDIN\n";
    print STDERR "    -o|-outfile     output file.         default=STDOUT\n";
    print STDERR "    -s|-stay        overwrite defaults by the last pixel/resolution specifies.\n";
    exit 1;
}

NGetOpt('help|h',         # help
        'pixel|p=i',      # default pixel
        'resolution|r=i', # default resolution
        'outfile|o=s',    # output file
        'infile|i=s',     # input file
        'stay|s',         # overwrite defaults
        ) || usage();

usage if $opt_help;
usage if $#ARGV == -1;

$default_pixel = $opt_pixel if defined $opt_pixel;
$default_res = $opt_resolution if defined $opt_resolution;


my (@pairs);

# make pixel/res pair

foreach (@ARGV) {
    my ($pixel, $res, $point);

    parse_pixel($_, \$pixel, \$res) || usage();
    
    push @pairs, [$pixel, $res];
    if (defined $opt_override) {
        $default_pixel = $pixel;
        $default_res = $res;
    }
    $point = int($pixel/($res/72.27)*10+0.5);
    printf STDERR
        "pixel=%i, resolution=%i -> point=%i\n", $pixel, $res, $point;
}

sub FOUNDRY { return 0; }
sub FAMILY_NAME { return 1; }
sub WEIGHT_NAME { return 2; }
sub SLANT { return 3; }
sub SETWIDTH_NAME { return 4; }
sub ADD_STYLE_NAME { return 5; }
sub PIXEL_SIZE { return 6; }
sub POINT_SIZE { return 7; }
sub RESOLUTION_X { return 8; }
sub RESOLUTION_Y { return 9; }
sub SPACING { return 10; }
sub AVERAGE_WIDTH { return 11; }
sub CHARSET_REGISTRY { return 12; }
sub CHARSET_ENCODING { return 13; }

open INPUT, $opt_infile && $opt_infile ne '-' ? $opt_infile:"<&STDIN";
open OUTPUT, $opt_outfile && $opt_outfile ne '-' ? ">$opt_outfile":">&STDOUT";

$_ = <INPUT>;
chomp;
do { print STDERR "Illegal Line : $_\n"; exit 1; } unless m,^\s*(\d+)\s*$,;
$lines = $1;

for ($line = 0; $line<$lines; $line++) {
    do { print STDERR "Unexpected File End\n"; exit 1; } unless $_ = <INPUT>;
    my (@xlfds, @aliases, $file, $xlfd);
    
    chomp;
    do { print STDERR "Illegal Line : $_\n"; exit 1; } unless m,^(\S+)\s+,;
    $file = $1; $xlfd = $';
    do {
        print STDERR "Illegal XLFD : $xlfd\n"; exit 1;
    } unless ((@xlfds = $xlfd =~ m,-[^\-]*,g) && $#xlfds == 13);

    if   (lc($xlfds[SLANT]) eq '-r' &&
          lc($xlfds[WEIGHT_NAME]) eq '-medium') {
        foreach (@pairs) {
            ($pixel, $res) = @$_;
            $point = int($pixel/($res/72.27)*10+0.5);
            
            $xlfds[PIXEL_SIZE] = "-$pixel";
            $xlfds[POINT_SIZE] = "-$point";
            $xlfds[RESOLUTION_X] = "-$res";
            $xlfds[RESOLUTION_Y] = "-$res";
            @aliases = (@xlfds);
            $aliases[PIXEL_SIZE] = '-0';
            
            printf OUTPUT
                "\"%s\" \"%s\"\n", join('', @aliases), join('', @xlfds);
        }
    }
}

# end of file

-- 
 ** Any opinions in this posting are my own and not those of my employers **
 CHOI, Junho                       <mailto:cjh@kr.freebsd.org>
 - Korea FreeBSD Users Group       <http://www.kr.freebsd.org/~cjh>
 - Web Data Bank Co. Seoul., ROK.  <http://www.wdb.co.kr> (+82-2-515-9941)
--
This list contains questions and answers about use of FreeBSD in Korea.
See also the Korea FreeBSD Users Group Web pages at http://www.kr.freebsd.org
--
To Unsubscribe: send mail to majordomo@kr.FreeBSD.org
with "unsubscribe questions" in the BODY of the message



[ ³¯Â¥¼ø »öÀÎ ] [ ´ñ±Û¼ø »öÀÎ ] [ ÃÖ»óÀ§ »öÀÎ]

Copyright © 1998-2005 Korea FreeBSD Users Group.
All rights reserved. webmaster at kr.FreeBSD.org
$Date: 2002/03/26 13:38:43 $
Powered by FreeBSD