NAME
Lingua::JA::Fold - fold Japanese text
SYNOPSIS
use Lingua::JA::Fold;
use Encode;
my $text = decode('utf8', 'アイウエオ æ¼¢å—');
my $obj = Lingua::JA::Fold->new($text);
# replace a [TAB] with 4 of [SPACE]s.
$obj->tab2space(4);
# convert half pitch 'Kana' letters to full pitch ones.
$obj->kana_half2full;
# fold the text under 2 full pitch letters par a line.
$obj->fold_full(2);
# result
print encode('utf8', $obj->output);
DESCRIPTION
This module is used for Japanese text wrapping and so on.
Japanese (Chinese and Korean would be the same) text has traditionally unique manner in printing. Basically it is used to be printed in monospace. Its width and height are about the same size. It is different from the alphabet letters which have variable width. Roughly say, we call the pitch of alphabet letters and Arabic numbers as 'half', and do the pitch of other letters as 'full'. In a Japanese text which is mixed with alphabet and Arabic numbers, a letter's width is 'full' or 'half'.
Thus manner makes text wrapping rather complicate thing.
METHODS
- new($string)
-
This is the constructor method of the module.
- output
-
Output the string.
- fold_full($i)
-
Fold the string within the specified length of $i in full pitch.
- tab2space($i)
-
Replace [TAB] with some [SPACE]s of $i in the string.
- kana_half2full
-
Converts from half pitch 'Kana's to full pitch ones in the string.
SEE ALSO
- Perl Module: Encode
NOTES
This module runs under Unicode/UTF-8 environment (hence Perl5.8 or later is required), you should input data in UTF-8 character encoding.
AUTHOR
Masanori HATA <lovewing@geocities.co.jp> (Saitama, JAPAN)
COPYRIGHT
Copyright (c) 2003 Masanori HATA. All rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
1 POD Error
The following errors were encountered while parsing the POD:
- Around line 151:
Non-ASCII character seen before =encoding in ''アイウエオ'. Assuming CP1252