Adding support for japanese in language.cpp,
...and the support for the sazanami-gothic.ttf font. Fixed SDL_ttf so it works with this font. Not adding the font itself (it is about 7Mb!). Testers should add it manually in the font/ directory.
This commit is contained in:
parent
04ba5d8068
commit
ad0e5691b1
4 changed files with 23 additions and 18 deletions
|
@ -1,7 +1,7 @@
|
|||
|
||||
[fonts]
|
||||
# This is marked as translatable, to allow translators to provide different font orders
|
||||
order=_ "Vera.ttf,Bepa-Roman.ttf,FreeSans.ttf"
|
||||
order=_ "Vera.ttf,Bepa-Roman.ttf,FreeSans.ttf,sazanami.ttf"
|
||||
[font]
|
||||
name=Vera.ttf
|
||||
codepoints=32-126,160-255,262-263,268-270,273,286-287,321-322,338-339,350-353,376,381-382,402,710-711
|
||||
|
@ -14,4 +14,11 @@
|
|||
name=FreeSans.ttf
|
||||
codepoints=32-126,160-384,386-393,395-396,398-403,409,413-415,421,423-425,427,429-430,452-483,486-493,496-501,504-539,542-543,550-563,592-596,598-601,603-604,608-609,613-618,621,623-627,629,633-639,642-645,647-649,652-654,656,668,670,672,710-711,714-715,728-733,768-772,774-776,778-780,783,785-788,806-808,884-885,890,894,900-906,908,910-929,931-974,1024-1119,1164-1220,1223-1224,1227-1228,1232-1269,1272-1273,1329-1366,1370-1374,1377-1415,1417-1418,1456-1465,1467-1476,1488-1514,1792-1805,1808-1836,1840-1866,2305-2306,2309-2315,2317,2320-2321,2323-2355,2357-2361,2364-2371,2373,2375-2377,2379-2381,2384-2385,2406-2416,2433-2435,2437-2444,2447-2448,2451-2472,2474-2480,2482,2486-2489,2492,2494-2500,2503-2504,2507-2509,2519,2524-2525,2527-2531,2534-2554,2565-2570,2575-2576,2579-2600,2602-2608,2610-2611,2613-2614,2616-2617,2620,2622-2626,2631-2632,2635-2637,2649-2652,2654,2662-2672,2674-2676,2689-2690,2693-2699,2709-2728,2730-2736,2738-2739,2741-2745,2749-2755,2759-2760,2763-2764,2768,2790-2799,2818-2819,2821-2823,2825,2827,2831,2835,2837-2840,2842,2844-2845,2847-2849,2858-2859,2863-2864,2866-2867,2870-2873,2878-2883,2887,2912,2918-2927,2946-2947,2949-2954,2958-2960,2962-2965,2969-2970,2972,2974-2975,2979-2980,2984-2986,2990-2997,2999-3001,3006-3009,3014-3016,3018-3021,3031,3034-3037,3041,3203,3205-3210,3214-3216,3218-3226,3228,3230-3240,3248-3251,3302-3311,3458-3459,3461,3465-3467,3473,3476,3481-3484,3486,3488-3490,3492-3493,3495-3499,3501-3505,3507-3515,3517,3520-3526,3530,3535-3540,3542,3544-3545,3551,7936-7957,7960-7965,7968-8005,8008-8013,8016-8023,8025,8027,8029,8031-8061,8064-8116,8118-8132,8134-8147,8150-8155,8157-8175,8178-8180,8182-8190,8208,8211-8212,8216-8227,8230,8240-8247,8249-8253,8260,8263-8265,8267,8304-8305,8308-8313,8320-8329,8359-8360,8362,8364,8459-8460,8464-8466,8470,8475-8476,8482,8486-8488,8490-8493,8496-8499,8531-8575,8592-8597,8629,8656-8660,8704,8706-8707,8709-8713,8719-8723,8727,8730,8733-8734,8736,8743-8750,8756,8764,8766,8769-8771,8777,8800,8804-8805,8853-8855,8869,8960,9674,9834,12289-12291,12293,12295-12305,12308-12309,12353-12435,12441,12443,12449-12542,63033-63041,63166,63171,63196,64256-64262,64285-64310,64312-64316,64318,64320-64321,64323-64324,64326-64335,65533
|
||||
[/font]
|
||||
[font]
|
||||
name=sazanami-gothic.ttf
|
||||
# Being large for codepoints: include characters
|
||||
# page-per-page, and non on a per-character basis, or else the
|
||||
# list would be huge.
|
||||
codepoints=32-126,160-255,305,321-322,331,338-339,402,593,602,658,710-711,714-715,728,730,732,913-929,931-937,945-969,977,981,1025,1040-1103,1105,12288-12543,12800-40959,63744-64255,65280-65439,65537-65991
|
||||
[/font]
|
||||
[/fonts]
|
||||
|
|
|
@ -435,6 +435,11 @@ std::vector<surface> const &text_surface::get_surfaces() const
|
|||
continue;
|
||||
font_style_setter const style_setter(ttfont, style_);
|
||||
|
||||
//DEBUG
|
||||
if (itor->text[0] == 'æ') {
|
||||
std::cerr << "Nihongo detected:\n";
|
||||
}
|
||||
|
||||
surface s = surface(TTF_RenderUNICODE_Blended(ttfont, (Uint16 const *)&(itor->ucs2_text.front()), color_));
|
||||
if(!s.null())
|
||||
surfs_.push_back(s);
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
/* $Id$ */
|
||||
/* vim:set encoding=utf-8: */
|
||||
/*
|
||||
Copyright (C) 2003 by David White <davidnwhite@optusnet.com.au>
|
||||
Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
|
||||
|
@ -51,6 +52,7 @@ language_def known_languages[] = {
|
|||
language_def("la_IT", "Latina"),
|
||||
language_def("hu_HU", "Magyar"),
|
||||
language_def("nl_NL", "Nederlands"),
|
||||
language_def("ja_JP", "日本語 (Nihongo)"),
|
||||
language_def("no_NO", "Norsk"),
|
||||
language_def("pl_PL", "Polski"),
|
||||
language_def("pt_BR", "Português do Brasil"),
|
||||
|
|
|
@ -521,7 +521,7 @@ static FT_Error Load_Glyph( TTF_Font* font, Uint16 ch, c_glyph* cached, int want
|
|||
* a freetype2 bug because it is inconsistent with the
|
||||
* freetype2 documentation under FT_Render_Mode section.
|
||||
* */
|
||||
if ( mono || !FT_IS_SCALABLE(face) ) {
|
||||
if ( mono || !FT_IS_SCALABLE(face) || dst->pixel_mode == FT_PIXEL_MODE_MONO ) {
|
||||
dst->pitch *= 8;
|
||||
}
|
||||
|
||||
|
@ -547,27 +547,18 @@ static FT_Error Load_Glyph( TTF_Font* font, Uint16 ch, c_glyph* cached, int want
|
|||
for( i = 0; i < src->rows; i++ ) {
|
||||
int soffset = i * src->pitch;
|
||||
int doffset = i * dst->pitch;
|
||||
if ( mono ) {
|
||||
if ( mono || dst->pixel_mode == FT_PIXEL_MODE_MONO ) {
|
||||
unsigned char *srcp = src->buffer + soffset;
|
||||
unsigned char *dstp = dst->buffer + doffset;
|
||||
int j;
|
||||
for ( j = 0; j < src->width; j += 8 ) {
|
||||
unsigned char ch = *srcp++;
|
||||
*dstp++ = (ch&0x80) >> 7;
|
||||
ch <<= 1;
|
||||
*dstp++ = (ch&0x80) >> 7;
|
||||
ch <<= 1;
|
||||
*dstp++ = (ch&0x80) >> 7;
|
||||
ch <<= 1;
|
||||
*dstp++ = (ch&0x80) >> 7;
|
||||
ch <<= 1;
|
||||
*dstp++ = (ch&0x80) >> 7;
|
||||
ch <<= 1;
|
||||
*dstp++ = (ch&0x80) >> 7;
|
||||
ch <<= 1;
|
||||
*dstp++ = (ch&0x80) >> 7;
|
||||
ch <<= 1;
|
||||
*dstp++ = (ch&0x80) >> 7;
|
||||
|
||||
int k;
|
||||
for ( k = 0; k < 8; ++k) {
|
||||
*dstp++ = ch & 0x80 ? 0xff : 0;
|
||||
ch <<= 1;
|
||||
}
|
||||
}
|
||||
} else if ( !FT_IS_SCALABLE(face) ) {
|
||||
/* This special case wouldn't
|
||||
|
|
Loading…
Add table
Reference in a new issue