Changeset 3499 in Sophya for trunk/SophyaPI
- Timestamp:
- Jun 17, 2008, 4:52:49 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaPI/PI/pifontx.cc
r2615 r3499 289 289 int count,k; 290 290 Display * mdsp = PIXDisplay(); 291 char **list ;291 char **list = NULL; 292 292 293 293 for (k=0; k<5; k++) { // Recherche de la fonte pour tailles croissantes 294 294 sprintf(buff,"-%s-%s-*-%d-*-*-*-*-*-*-*", apd.fntFam[kfn], fnbi_b[jat], fntsz[isz]+k); 295 295 list = XListFonts(mdsp, buff, 10, &count); 296 XFreeFontNames(list);297 296 if ((count <= 0) && (fnbo_b[jat] != NULL)) { 297 if (list) XFreeFontNames(list); 298 298 sprintf(buff,"-%s-%s-*-%d-*-*-*-*-*-*-*", apd.fntFam[kfn], fnbo_b[jat], fntsz[isz]+k); 299 299 list = XListFonts(mdsp, buff, 10, &count); 300 XFreeFontNames(list);301 300 } 302 301 if (count > 0) break; 303 302 } 304 303 // certaines fontes n'ont pas de version bold ou italique 305 304 if ( (count == 0) && (jat > 0) ) { 306 305 for (k=0; k<5; k++) { // Recherche de la fonte pour tailles croissantes 306 if (list) XFreeFontNames(list); 307 307 sprintf(buff,"-%s-%s-*-%d-*-*-*-*-*-*-*", apd.fntFam[kfn], fnbi_b[0], fntsz[isz]+k); 308 308 list = XListFonts(mdsp, buff, 10, &count); 309 XFreeFontNames(list);310 309 if (count > 0) break; 311 }312 310 } 313 if (count > 0) 314 fntst[isz][jat][kfn] = XLoadQueryFont(mdsp, buff); 315 else 316 { printf("PIFontX::LoadFontSt/ Pb font %s - Using default \n", buff); 317 fntst[isz][jat][kfn] = defnt; } 311 } 312 if (count > 0) { 313 for (int kkk=0; kkk<count; kkk++) { 314 fntst[isz][jat][kfn] = XLoadQueryFont(mdsp, list[kkk]); 315 if (fntst[isz][jat][kfn] != NULL) break; 316 } 317 if (list) XFreeFontNames(list); 318 } 319 else { 320 if (list) XFreeFontNames(list); 321 printf("PIFontX::LoadFontSt/ Pb font %s - Using default \n", buff); 322 fntst[isz][jat][kfn] = defnt; 323 } 318 324 } 319 325 … … 343 349 XtNumber(resources), NULL, 0); 344 350 sprintf(buff,"-%s-*-*-*-*-*-*-*-*-*-*-*-*", apd.fntFam[0]); 351 list = NULL; 345 352 list = XListFonts(mdsp, buff, 15, &count); 346 XFreeFontNames(list);347 353 if (count < 5) 348 354 { … … 350 356 count, apd.fntFam[0]); 351 357 apd.fntFam[0] = "*-courier"; 358 if (list) XFreeFontNames(list); 352 359 } 353 360 sprintf(buff,"-%s-%s-*-*-*-*-12-*-*-*-*", apd.fntFam[0], fnbi_b[0]); 354 361 list = XListFonts(mdsp, buff, 10, &count); 355 XFreeFontNames(list);356 362 if (count < 1) { 363 if (list) XFreeFontNames(list); 357 364 sprintf(buff,"-*-fixed-*-*-*-*-12-*-*-*-*-*-*-*"); 358 365 list = XListFonts(mdsp, buff, 10, &count); 359 XFreeFontNames(list);360 366 if (count < 1) { 367 if (list) XFreeFontNames(list); 361 368 sprintf(buff,"fixed"); 362 369 list = XListFonts(mdsp, buff, 10, &count); 363 XFreeFontNames(list);364 370 } 365 371 if (count < 1) { 372 if (list) XFreeFontNames(list); 366 373 strcpy(buff,""); 367 374 list = XListFonts(mdsp, buff, 10, &count); 368 XFreeFontNames(list);369 375 } 370 376 } 371 377 if (count < 1) { 378 if (list) XFreeFontNames(list); 372 379 printf("PIFontX::Init/ Erreur, no font found ... \n"); 373 380 defnt = NULL; 374 } 375 else defnt = XLoadQueryFont(mdsp, buff); 376 381 //Reza+Bruno, 17 Juin 2008 - Il faut lancer une exception 382 } 383 else { 384 defnt = NULL; 385 for (int kkk=0; kkk<count; kkk++) { 386 defnt = XLoadQueryFont(mdsp, list[kkk]); 387 if (defnt != NULL) break; 388 } 389 if (list) XFreeFontNames(list); 390 } 377 391 for (i=0; i<NMAXFONTSZ; i++) 378 392 for (j=0; j<NMAXFONTATT; j++)
Note:
See TracChangeset
for help on using the changeset viewer.