[MPlayer-dev-eng] [PATCH]breakline properly with subtitles using Chinese
Zuxy Meng
zuxy.meng at gmail.com
Fri Nov 25 03:19:05 CET 2005
Hi,
2005/11/25, Timothy Lee <timothy.lee at siriushk.com>:
> Rich Felker wrote:
> > On Thu, Nov 24, 2005 at 03:20:35PM -0500, The Wanderer wrote:
> >
> This is a function I wrote for another library that uses CJK code blocks
> to check for permissible line breaks. Perhaps it can be used as a
> reference:
>
> // Returns non-zero value if character allows line-break after it
> int is_linebreak(unsigned int ucs)
> {
> /* Space or tab */
> if (ucs == ' ' || ucs == '\t') return 1;
>
> /* U+2E80..U+2EFF: CJK Radical Supplement */
> /* U+2F00..U+2FDF: Kangxi Radicals */
> /* U+2FF0..U+2FFF: Ideographic Description Characters */
> /* U+3000..U+303F: CJK Symbols and Punctuation */
> /* U+3040..U+309F: Hiragana */
> /* U+30A0..U+30FF: Katakana */
> /* U+3100..U+312F: Bopomofo */
> /* U+3130..U+318F: Hangul Compatibility Jamo */
> /* U+3190..U+319F: Kanbun */
> /* U+31A0..U+31BF: Bopomofo Extended */
> /* U+31C0..U+31EF: CJK Strokes */
> /* U+31F0..U+31FF: Katakana Phonetic Extensions */
> /* U+3200..U+32FF: Enclosed CJK Letters and Months */
> /* U+3300..U+33FF: CJK Compatibility */
> /* U+3400..U+4DB5: CJK Ideographs Extension A */
> if (ucs >= 0x2e80 && ucs <= 0x4db5) return 1;
>
> /* U+4E00..U+9FBB: CJK Ideographs */
> if (ucs >= 0x4e00 && ucs <= 0x9fbb) return 1;
>
> /* U+A000..U+A48F: Yi Syllables */
> /* U+A490..U+A4CF: Yi Radicals */
> if (ucs >= 0xa000 && ucs <= 0xa4cf) return 1;
>
> /* U+F900..U+FAFF: CJK Compatibility Ideographs */
> if (ucs >= 0xf900 && ucs <= 0xfaff) return 1;
>
> /* U+FE30..U+FE4F: CJK Compatibility Forms */
> /* U+FE50..U+FE6F: Small Form Variants */
> if (ucs >= 0xfe30 && ucs <= 0xfe6f) return 1;
>
> /* U+FF00..U+FFEF: Half-Width CJK Symbols and Punctuation */
> if (ucs == 0xff0c || ucs == 0xff0e || ucs == 0xff1a || ucs == 0xff1b ||
> (ucs >= 0xff60 && ucs <= 0xffdf)) return 1;
>
> return 0;
> }
>
I guess this piece of code deals with UCS-2 encoded texts?
--
Zuxy
Beauty is truth,
While truth is beauty.
PGP KeyID: E8555ED6
More information about the MPlayer-dev-eng
mailing list