Add p5-Text-CharWidth, get number of occupied columns of a string on terminal.

This module supplies features similar as wcwidth(3) and wcswidth(3) in C
language.

Characters have its own width on terminal depending on locale. For example,
ASCII characters occupy one column per character, east Asian fullwidth
characters (like Hiragana or Han Ideograph) occupy two columns per
character, and combining characters (apperaring in ISO-8859-11 Thai,
Unicode, and so on) occupy zero columns per character. mbwidth() gives the
width of the first character of the given string and mbswidth() gives the
width of the whole given string.

The names of mbwidth and mbswidth came from "multibyte" versions of wcwidth
and wcswidth which are "wide character" versions.

mblen(string) returns number of bytes of the first character of the string.
Please note that a character may consist of multiple bytes in multibyte
encodings such as UTF-8, EUC-JP, EUC-KR, GB2312, or Big5.

mbwidth(string) returns the width of the first character of the string.
mbswidth(string) returns the width of the whole string.

Parameters are to be given in locale encodings, not always in UTF-8.

WWW: http://search.cpan.org/dist/Text-CharWidth/
This commit is contained in:
Chin-San Huang 2008-08-31 08:31:02 +00:00
parent b3759e494e
commit d2d421fd99
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=219506
5 changed files with 56 additions and 0 deletions

View file

@ -566,6 +566,7 @@
SUBDIR += p5-Text-CSV_PP SUBDIR += p5-Text-CSV_PP
SUBDIR += p5-Text-CSV_XS SUBDIR += p5-Text-CSV_XS
SUBDIR += p5-Text-Capitalize SUBDIR += p5-Text-Capitalize
SUBDIR += p5-Text-CharWidth
SUBDIR += p5-Text-Chomp SUBDIR += p5-Text-Chomp
SUBDIR += p5-Text-Context-EitherSide SUBDIR += p5-Text-Context-EitherSide
SUBDIR += p5-Text-Decorator SUBDIR += p5-Text-Decorator

View file

@ -0,0 +1,21 @@
# New ports collection makefile for: p5-Text-CharWidth
# Date created: 2008/08/31
# Whom: chinsan
#
# $FreeBSD$
#
PORTNAME= Text-CharWidth
DISTVERSION= 0.04
CATEGORIES= textproc perl5
MASTER_SITES= CPAN
PKGNAMEPREFIX= p5-
MAINTAINER= chinsan@FreeBSD.org
COMMENT= Get number of occupied columns of a string on terminal
PERL_CONFIGURE= YES
MAN3= Text::CharWidth.3
.include <bsd.port.mk>

View file

@ -0,0 +1,3 @@
MD5 (Text-CharWidth-0.04.tar.gz) = 37a723df0580c0758c0ee67b37336c15
SHA256 (Text-CharWidth-0.04.tar.gz) = abded5f4fdd9338e89fd2f1d8271c44989dae5bf50aece41b6179d8e230704f8
SIZE (Text-CharWidth-0.04.tar.gz) = 8387

View file

@ -0,0 +1,24 @@
This module supplies features similar as wcwidth(3) and wcswidth(3) in C
language.
Characters have its own width on terminal depending on locale. For example,
ASCII characters occupy one column per character, east Asian fullwidth
characters (like Hiragana or Han Ideograph) occupy two columns per
character, and combining characters (apperaring in ISO-8859-11 Thai,
Unicode, and so on) occupy zero columns per character. mbwidth() gives the
width of the first character of the given string and mbswidth() gives the
width of the whole given string.
The names of mbwidth and mbswidth came from "multibyte" versions of wcwidth
and wcswidth which are "wide character" versions.
mblen(string) returns number of bytes of the first character of the string.
Please note that a character may consist of multiple bytes in multibyte
encodings such as UTF-8, EUC-JP, EUC-KR, GB2312, or Big5.
mbwidth(string) returns the width of the first character of the string.
mbswidth(string) returns the width of the whole string.
Parameters are to be given in locale encodings, not always in UTF-8.
WWW: http://search.cpan.org/dist/Text-CharWidth/

View file

@ -0,0 +1,7 @@
%%SITE_PERL%%/%%PERL_ARCH%%/auto/Text/CharWidth/CharWidth.so
%%SITE_PERL%%/%%PERL_ARCH%%/auto/Text/CharWidth/CharWidth.bs
%%SITE_PERL%%/%%PERL_ARCH%%/auto/Text/CharWidth/.packlist
%%SITE_PERL%%/%%PERL_ARCH%%/Text/CharWidth.pm
@dirrmtry %%SITE_PERL%%/%%PERL_ARCH%%/auto/Text/CharWidth
@dirrmtry %%SITE_PERL%%/%%PERL_ARCH%%/auto/Text
@dirrmtry %%SITE_PERL%%/%%PERL_ARCH%%/Text