wxFontEncodingArray wxEncodingConverter::GetAllEquivalents(wxFontEncoding enc) { int i, clas, e, j ; const wxFontEncoding *f; wxFontEncodingArray arr; arr = GetPlatformEquivalents(enc); // we want them to be first items in array clas = 0; while (EquivalentEncodings[clas][0][0] != STOP) { for (i = 0; i < NUM_OF_PLATFORMS; i++) for (e = 0; EquivalentEncodings[clas][i][e] != STOP; e++) if (EquivalentEncodings[clas][i][e] == enc) { for (j = 0; j < NUM_OF_PLATFORMS; j++) for (f = EquivalentEncodings[clas][j]; *f != STOP; f++) if (!FindEncoding(arr, *f)) arr.push_back(*f); i = NUM_OF_PLATFORMS/*hack*/; break; } clas++; } return arr; }
wxFontEncodingArray wxEncodingConverter::GetPlatformEquivalents(wxFontEncoding enc, int platform) { if (platform == wxPLATFORM_CURRENT) { #if defined(__WXMSW__) platform = wxPLATFORM_WINDOWS; #elif defined(__WXGTK__) || defined(__WXMOTIF__) platform = wxPLATFORM_UNIX; #elif defined(__WXPM__) platform = wxPLATFORM_OS2; #elif defined(__WXMAC__) platform = wxPLATFORM_MAC; #endif } int i, clas, e ; const wxFontEncoding *f; wxFontEncodingArray arr; clas = 0; while (EquivalentEncodings[clas][0][0] != STOP) { for (i = 0; i < NUM_OF_PLATFORMS; i++) for (e = 0; EquivalentEncodings[clas][i][e] != STOP; e++) if (EquivalentEncodings[clas][i][e] == enc) { for (f = EquivalentEncodings[clas][platform]; *f != STOP; f++) if (*f == enc) arr.push_back(enc); for (f = EquivalentEncodings[clas][platform]; *f != STOP; f++) if (!FindEncoding(arr, *f)) arr.push_back(*f); i = NUM_OF_PLATFORMS/*hack*/; break; } clas++; } return arr; }
/* * Compile the terminal capabilities for a display. * Input: tgetent(, D_termname) extra_incap, extra_outcap. * Effect: display initialisation. */ int InitTermcap(int width, int height) { char *s; int i; char tbuf[TERMCAP_BUFSIZE], *tp; int t, xue, xse, xme; memset(tbuf, 0, sizeof(tbuf)); if (*D_termname == 0 || e_tgetent(tbuf, D_termname) != 1) { Msg(0, "Cannot find terminfo entry for '%s'.", D_termname); return -1; } if ((D_tentry = malloc(TERMCAP_BUFSIZE + (extra_incap ? strlen(extra_incap) + 1 : 0))) == 0) { Msg(0, "%s", strnomem); return -1; } /* * loop through all needed capabilities, record their values in the display */ tp = D_tentry; for (i = 0; i < T_N; i++) { switch (term[i].type) { case T_FLG: D_tcs[i].flg = e_tgetflag(term[i].tcname); break; case T_NUM: D_tcs[i].num = e_tgetnum(term[i].tcname); break; case T_STR: D_tcs[i].str = e_tgetstr(term[i].tcname, &tp); /* no empty strings, please */ if (D_tcs[i].str && *D_tcs[i].str == 0) D_tcs[i].str = 0; break; default: Panic(0, "Illegal tc type in entry #%d", i); /*NOTREACHED*/} } /* * Now a good deal of sanity checks on the retrieved capabilities. */ if (D_HC) { Msg(0, "You can't run screen on a hardcopy terminal."); return -1; } if (D_OS) { Msg(0, "You can't run screen on a terminal that overstrikes."); return -1; } if (!D_CL) { Msg(0, "Clear screen capability required."); return -1; } if (!D_CM) { Msg(0, "Addressable cursor capability required."); return -1; } if ((s = getenv("COLUMNS")) && (i = atoi(s)) > 0) D_CO = i; if ((s = getenv("LINES")) && (i = atoi(s)) > 0) D_LI = i; if (width) D_CO = width; if (height) D_LI = height; if (D_CO <= 0) D_CO = 80; if (D_LI <= 0) D_LI = 24; if (D_CTF) { /* standard fixes for xterms etc */ /* assume color for everything that looks ansi-compatible */ if (!D_CAF && D_ME && (InStr(D_ME, "\033[m") || InStr(D_ME, "\033[0m"))) { D_CAF = "\033[3%p1%dm"; D_CAB = "\033[4%p1%dm"; } if (D_OP && InStr(D_OP, "\033[39;49m")) D_CAX = 1; if (D_OP && (InStr(D_OP, "\033[m") || InStr(D_OP, "\033[0m"))) D_OP = 0; /* ISO2022 */ if ((D_EA && InStr(D_EA, "\033(B")) || (D_AS && InStr(D_AS, "\033(0"))) D_CG0 = 1; if (InStr(D_termname, "xterm") || InStr(D_termname, "rxvt") || (D_CKM && InStr(D_CKM, "\033[M"))) D_CXT = 1; /* "be" seems to be standard for xterms... */ if (D_CXT) D_BE = 1; } if (nwin_options.flowflag == nwin_undef.flowflag) nwin_default.flowflag = D_CNF ? FLOW_OFF : D_NX ? FLOW_ON : FLOW_AUTOFLAG; D_CLP |= (!D_AM || D_XV || D_XN); if (!D_BL) D_BL = "\007"; if (!D_BC) { if (D_BS) D_BC = "\b"; else D_BC = D_LE; } if (!D_CR) D_CR = "\r"; if (!D_NL) D_NL = "\n"; /* * Set up attribute handling. * This is rather complicated because termcap has different * attribute groups. */ if (D_UG > 0) D_US = D_UE = 0; if (D_SG > 0) D_SO = D_SE = 0; /* Unfortunately there is no 'mg' capability. * For now we think that mg > 0 if sg and ug > 0. */ if (D_UG > 0 && D_SG > 0) D_MH = D_MD = D_MR = D_MB = D_ME = 0; xue = ATYP_U; xse = ATYP_S; xme = ATYP_M; if (D_SO && D_SE == 0) { Msg(0, "Warning: 'so' but no 'se' capability."); if (D_ME) xse = xme; else D_SO = 0; } if (D_US && D_UE == 0) { Msg(0, "Warning: 'us' but no 'ue' capability."); if (D_ME) xue = xme; else D_US = 0; } if ((D_MH || D_MD || D_MR || D_MB) && D_ME == 0) { Msg(0, "Warning: 'm?' but no 'me' capability."); D_MH = D_MD = D_MR = D_MB = 0; } /* * Does ME also reverse the effect of SO and/or US? This is not * clearly specified by the termcap manual. Anyway, we should at * least look whether ME and SE/UE are equal: */ if (D_UE && D_SE && strcmp(D_SE, D_UE) == 0) xse = xue; if (D_SE && D_ME && strcmp(D_ME, D_SE) == 0) xse = xme; if (D_UE && D_ME && strcmp(D_ME, D_UE) == 0) xue = xme; for (i = 0; i < NATTR; i++) { D_attrtab[i] = D_tcs[T_ATTR + i].str; D_attrtyp[i] = i == ATTR_SO ? xse : (i == ATTR_US ? xue : xme); } /* Set up missing entries (attributes are priority ordered) */ s = 0; t = 0; for (i = 0; i < NATTR; i++) if ((s = D_attrtab[i])) { t = D_attrtyp[i]; break; } for (i = 0; i < NATTR; i++) { if (D_attrtab[i] == 0) { D_attrtab[i] = s; D_attrtyp[i] = t; } else { s = D_attrtab[i]; t = D_attrtyp[i]; } } if (D_CAF || D_CAB || D_CSF || D_CSB) D_hascolor = 1; if (D_UT) D_BE = 1; /* screen erased with background color */ if (!D_DO) D_DO = D_NL; if (!D_SF) D_SF = D_NL; if (D_IN) D_IC = D_IM = 0; if (D_EI == 0) D_IM = 0; /* some strange termcap entries have IC == IM */ if (D_IC && D_IM && strcmp(D_IC, D_IM) == 0) D_IC = 0; if (D_KE == 0) D_KS = 0; if (D_CVN == 0) D_CVR = 0; if (D_VE == 0) D_VI = D_VS = 0; if (D_CCE == 0) D_CCS = 0; if (D_CG0) { if (D_CS0 == 0) D_CS0 = "\033(%p1%c"; if (D_CE0 == 0) D_CE0 = "\033(B"; D_AC = 0; D_EA = 0; } else if (D_AC || (D_AS && D_AE)) { /* some kind of graphics */ D_CS0 = (D_AS && D_AE) ? D_AS : ""; D_CE0 = (D_AS && D_AE) ? D_AE : ""; D_CC0 = D_AC; } else { D_CS0 = D_CE0 = ""; D_CC0 = 0; D_AC = ""; /* enable default string */ } for (i = 0; i < 256; i++) D_c0_tab[i] = i; if (D_AC) { /* init with default string first */ s = "l+m+k+j+u+t+v+w+q-x|n+o~s_p\"r#`+a:f'g#~o.v-^+<,>h#I#0#y<z>"; for (i = (strlen(s) - 2) & ~1; i >= 0; i -= 2) D_c0_tab[(int)(unsigned char)s[i]] = s[i + 1]; } if (D_CC0) for (i = (strlen(D_CC0) - 2) & ~1; i >= 0; i -= 2) D_c0_tab[(int)(unsigned char)D_CC0[i]] = D_CC0[i + 1]; if (D_PF == 0) D_PO = 0; if (D_CXC) if (CreateTransTable(D_CXC)) return -1; /* Termcap fields Z0 & Z1 contain width-changing sequences. */ if (D_CZ1 == 0) D_CZ0 = 0; CheckScreenSize(0); if (D_TS == 0 || D_FS == 0 || D_DS == 0) D_HS = 0; if (D_HS) { if (D_WS < 0) D_WS = 0; } D_has_hstatus = hardstatusemu & ~HSTATUS_ALWAYS; if (D_HS && !(hardstatusemu & HSTATUS_ALWAYS)) D_has_hstatus = HSTATUS_HS; if (D_CKJ) { int enc = FindEncoding(D_CKJ); if (enc != -1) D_encoding = enc; } if (!D_tcs[T_NAVIGATE].str && D_tcs[T_NAVIGATE + 1].str) D_tcs[T_NAVIGATE].str = D_tcs[T_NAVIGATE + 1].str; /* kh = @1 */ if (!D_tcs[T_NAVIGATE + 2].str && D_tcs[T_NAVIGATE + 3].str) D_tcs[T_NAVIGATE + 2].str = D_tcs[T_NAVIGATE + 3].str; /* kH = @7 */ D_UPcost = CalcCost(D_UP); D_DOcost = CalcCost(D_DO); D_NLcost = CalcCost(D_NL); D_LEcost = CalcCost(D_BC); D_NDcost = CalcCost(D_ND); D_CRcost = CalcCost(D_CR); D_IMcost = CalcCost(D_IM); D_EIcost = CalcCost(D_EI); if (D_CAN) { D_auto_nuke = true; } if (D_COL > 0) { D_obufmax = D_COL; D_obuflenmax = D_obuflen - D_obufmax; } /* Some xterm entries set F0 and F10 to the same string. Nuke F0. */ if (D_tcs[T_CAPS].str && D_tcs[T_CAPS + 10].str && !strcmp(D_tcs[T_CAPS].str, D_tcs[T_CAPS + 10].str)) D_tcs[T_CAPS].str = 0; /* Some xterm entries set kD to ^?. Nuke it. */ if (D_tcs[T_NAVIGATE_DELETE].str && !strcmp(D_tcs[T_NAVIGATE_DELETE].str, "\0177")) D_tcs[T_NAVIGATE_DELETE].str = 0; /* wyse52 entries have kcub1 == kb == ^H. Nuke... */ if (D_tcs[T_CURSOR + 3].str && !strcmp(D_tcs[T_CURSOR + 3].str, "\008")) D_tcs[T_CURSOR + 3].str = 0; D_nseqs = 0; for (i = 0; i < T_OCAPS - T_CAPS; i++) remap(i, 1); for (i = 0; i < kmap_extn; i++) remap(i + (KMAP_KEYS + KMAP_AKEYS), 1); D_seqp = D_kmaps + 3; D_seql = 0; D_seqh = 0; D_tcinited = 1; MakeTermcap(0); CheckEscape(); return 0; }
static void ReadPSFontMap(struct psfontmap *entry) { char *pos,*end,*psname; int nameno = 0; DEBUG_PRINT(DEBUG_FT,("\n PSFONTMAP: %s ",entry->tfmname)); pos=entry->line; end=entry->end; while(pos < end) { if (*pos=='<') { /* filename follows */ pos++; if (pos<end && *pos=='<') { /* <<download.font */ pos++; entry->psfile = newword((char**)&pos,end); DEBUG_PRINT(DEBUG_FT,("<%s ",entry->psfile)); } else if (pos<end && *pos=='[') { /* <[encoding.file */ pos++; entry->encname = newword((char**)&pos,end); DEBUG_PRINT(DEBUG_FT,("<[%s ",entry->encname)); } else { /* <some.file */ char* word =newword((char**)&pos,end); if (strncmp(word+strlen(word)-4,".enc",4)==0) {/* <some.enc */ entry->encname=word; DEBUG_PRINT(DEBUG_FT,("<[%s ",entry->encname)); } else { /* <font */ entry->psfile=word; DEBUG_PRINT(DEBUG_FT,("<%s ",entry->psfile)); } } } else if (*pos=='"') { /* PS code: reencoding/tranformation exists */ char *word; double cxx=1.0,cxy=0.0; pos++; DEBUG_PRINT(DEBUG_FT,("\"")); while(pos < end && *pos!='"') { word=newword((char**)&pos,end); while(pos < end && (*pos==' ' || *pos=='\t')) pos++; if (pos+10<end && strncmp(pos,"ExtendFont",10)==0) { cxx=strtod(word,NULL); pos+=10; DEBUG_PRINT(DEBUG_FT,("%f ExtendFont ",cxx)); } else if (pos+9<end && strncmp(pos,"SlantFont",9)==0) { pos+=9; cxy=strtod(word,NULL); DEBUG_PRINT(DEBUG_FT,("%f SlantFont ",cxy)); } else if (pos+12<end && strncmp(pos,"ReEncodeFont",12)==0) { pos+=12; DEBUG_PRINT(DEBUG_FT,("%s ReEncodeFont ",word)); } else { DEBUG_PRINT(DEBUG_FT,("(?:%s) ",word)); } free(word); } #ifdef HAVE_FT2 entry->ft_transformp=&(entry->ft_transform); entry->ft_transform.xx=(FT_Fixed)(cxx*0x10000); entry->ft_transform.xy=(FT_Fixed)(cxy*0x10000); entry->ft_transform.yx=0; entry->ft_transform.yy=0x10000; #endif DEBUG_PRINT(DEBUG_FT,("\" ")); pos++; } else { /* bare word */ switch (++nameno) { case 1: /* first word is tfmname and perhaps psname, NOT psfile */ while(pos<end && *pos!=' ' && *pos!='\t') pos++; psname=entry->tfmname; break; case 2: /* second word is psname, NOT psfile */ psname = newword((char**)&pos,end); DEBUG_PRINT(DEBUG_FT,("(%s) ",psname)); free(psname); break; case 3: /* third word is encoding */ entry->encname = newword((char**)&pos,end); DEBUG_PRINT(DEBUG_FT,("<[%s ",entry->encname)); break; default: while(pos<end && *pos!=' ' && *pos!='\t') pos++; Warning("more than three bare words in font map entry"); } } while(pos < end && (*pos==' ' || *pos=='\t')) pos++; } if (entry->psfile==NULL) { /* No psfile-name given, use tfmname */ entry->psfile=copyword(entry->tfmname); DEBUG_PRINT(DEBUG_FT,(" <%s ",entry->psfile)); } if (entry->encname!=NULL && (entry->encoding=FindEncoding(entry->encname))==NULL) Warning("unable to load font encoding '%s' for %s", entry->encname,entry->tfmname); }