The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Lingua::JA::Fold - fold Japanese text

SYNOPSIS

 use Lingua::JA::Fold;
 use Encode;
 
 my $text = decode('utf8', 'アイウエオ     漢字');
 
 # replace a [TAB] with 4 of [SPACE]s.
 $text = Lingua::JA::Fold::tab2space(4, $text);
 # convert half pitch 'Kana' letters to full pitch ones.
 $text = Lingua::JA::Fold::kana_half2full($text);
 
 # fold the text under 2 full pitch letters par a line.
 $text = Lingua::JA::Fold::fold_full(2, $text);
 
 # result
 print encode('utf8', $text);

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

fold_full($length, $string)

This method returns folded string within the specified length in full pitch.

tab2space($space, $string)

This method converts [TAB] with some [SPACE]s of $space in the $string. Then returns $string.

kana_half2full($string)

This method converts half pitch 'Kana's to full pitch ones in the $string. Then returns $string.

SEE ALSO

Perl Module: Encode

NOTES

This module runs under Unicode/UTF-8 environment (then 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 126:

Non-ASCII character seen before =encoding in ''アイウエオ'. Assuming CP1252