mirror of https://github.com/mpv-player/mpv
Add support for Latin National Option Sub-Sets
Modified Otvos Attila's patch oattila at chello dot hu git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@24204 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
parent
0f559826b0
commit
3e0d0aca85
|
@ -229,6 +229,38 @@ static unsigned int lang_chars[LANGS][0x60]={
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Latin National Option Sub-Sets
|
||||||
|
* see Table 36 of ETS specification for details.
|
||||||
|
*
|
||||||
|
* 00: £ $ @ « ½ » ¬ # ¼ ¦ ¾ ÷ English
|
||||||
|
* 01: é ï à ë ê ù î # è â ô û ç French
|
||||||
|
* 02: # ¤ É Ä Ö Å Ü _ é ä ö å ü Swedish/Finnish/Hungarian
|
||||||
|
* 03: # u c t z ý í r é á e ú s Czech/Slovak
|
||||||
|
* 04: # $ § Ä Ö Ü ^ _ ° ä ö ü ß German
|
||||||
|
* 05: ç $ ¡ á é í ó ú ¿ ü ñ è à Portuguese/Spanish
|
||||||
|
* 06: £ $ é ° ç » ¬ # ù à ò è ì Italian
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
static unsigned int latin_subchars[8][13]={
|
||||||
|
// English
|
||||||
|
{0xa3,0x24,0x40,0xab,0xbd,0xbb,0xac,0x23,0xad,0xbc,0xa6,0xbe,0xf7},
|
||||||
|
// French
|
||||||
|
{0xe9,0xef,0xe0,0xeb,0xea,0xf9,0xee,0x23,0xe8,0xe2,0xf4,0xfb,0xe7},
|
||||||
|
// Swedish/Finnish/Hungarian
|
||||||
|
{0x23,0xa4,0xc9,0xc4,0xd6,0xc5,0xdc,0x5f,0xe9,0xe4,0xf6,0xe5,0xfc},
|
||||||
|
// Czech/Slovak
|
||||||
|
{0x23,0x75,0x63,0x74,0x7a,0xfd,0xed,0x72,0xe9,0xe1,0x65,0xfa,0x73},
|
||||||
|
// German
|
||||||
|
{0x23,0x24,0xa7,0xc4,0xd6,0xdc,0x5e,0x5f,0xb0,0xe4,0xf6,0xfc,0xdf},
|
||||||
|
// Portuguese/Spanish
|
||||||
|
{0xe7,0x24,0xa1,0xe1,0xe9,0xed,0xf3,0xfa,0xbf,0xfc,0xf1,0xe8,0xe0},
|
||||||
|
// Italian
|
||||||
|
{0xa3,0x24,0xe9,0xb0,0xe7,0xbb,0xac,0x23,0xf9,0xe0,0xf2,0xe8,0xec},
|
||||||
|
// Reserved
|
||||||
|
{0x23,0x24,0x40,0x5b,0x5c,0x5d,0x5e,0x5f,0x60,0x7b,0x7c,0x7d,0x7e}
|
||||||
|
};
|
||||||
|
|
||||||
static int lang2id (int lang){
|
static int lang2id (int lang){
|
||||||
switch(lang){
|
switch(lang){
|
||||||
case 0:
|
case 0:
|
||||||
|
@ -255,8 +287,20 @@ static int lang2id (int lang){
|
||||||
*/
|
*/
|
||||||
static unsigned int conv2uni(unsigned int p,int lang)
|
static unsigned int conv2uni(unsigned int p,int lang)
|
||||||
{
|
{
|
||||||
|
int charset=lang2id(lang);
|
||||||
if(p<0x80 && p>=0x20){
|
if(p<0x80 && p>=0x20){
|
||||||
return lang_chars[lang][p-0x20];
|
if(charset==LAT_UNI){
|
||||||
|
if (p>=0x23 && p<=0x24){
|
||||||
|
return latin_subchars[lang][p-0x23];
|
||||||
|
}else if (p==0x40){
|
||||||
|
return latin_subchars[lang][2];
|
||||||
|
}else if (p>=0x5b && p<=0x60){
|
||||||
|
return latin_subchars[lang][p-0x5c+3];
|
||||||
|
}else if (p>=0x7b && p<=0x7e){
|
||||||
|
return latin_subchars[lang][p-0x7b+9];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return lang_chars[charset][p-0x20];
|
||||||
}else
|
}else
|
||||||
return 0x20;
|
return 0x20;
|
||||||
}
|
}
|
||||||
|
@ -517,7 +561,7 @@ static void decode_page(tt_char* p,int lang,unsigned char* raw)
|
||||||
p[i].unicode=c-0x20;
|
p[i].unicode=c-0x20;
|
||||||
if (p[i].unicode>0x3f) p[i].unicode-=0x20;
|
if (p[i].unicode>0x3f) p[i].unicode-=0x20;
|
||||||
}else
|
}else
|
||||||
p[i].unicode=conv2uni(c,lang2id(p[i].lng));
|
p[i].unicode=conv2uni(c,p[i].lng);
|
||||||
|
|
||||||
p[i].fg=fg_color;
|
p[i].fg=fg_color;
|
||||||
p[i].bg=bg_color;
|
p[i].bg=bg_color;
|
||||||
|
|
Loading…
Reference in New Issue