⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 fontdatac.c

📁 linux下的E_MAIL客户端源码
💻 C
📖 第 1 页 / 共 5 页
字号:
   if ( !found ) { // Try without foundry, family, weight or slant      BuildName("*", "*", "*", "*", "*", "*",		"*", "*", resStr, "*", "*", charset, bname);      found = FindSmaller(bname);      if ( !found ) { // Try without res	 BuildName("*", "*", "*", "*", "*", "*",		   "*", "*", "*", "*", "*", charset, bname);	 found = FindSmaller(bname);      }   }//// If nothing worked, return this font//   if ( !found ) {#if 0      StringC errmsg("I could not find a smaller version of the font: ");      errmsg += name;      halApp->PopupMessage(errmsg);#else      if ( debug1 )	 cout <<"I could not find a smaller version of the font: " <<name<<endl;#endif      if ( debug1 ) cout <<"Using: " <<name NL;      smaller = this;      return smaller;   }//// Create a new font structure//   if ( debug1 ) cout <<"Creating smaller font: " <<bname NL;   smaller = new FontDataC(bname);   if ( !smaller->loaded ) {      delete smaller;      smaller = this;   }   freeSmaller = True;   return smaller;} // End Smaller/*---------------------------------------------------------------------- * Method to look through a list of font names for a font matching the *    given criteria that is smaller than the current one. */BooleanFontDataC::FindSmaller(StringC& fname){   if ( debug2 ) cout <<"Trying smaller: " <<fname NL;   int	actual;   char	**names = XListFonts(halApp->display, fname, 100, &actual);   if ( !names ) return False;//// See if there's a smaller point size in the list//   Boolean	found = False;   int		i = 0;   CharC	name;   StringC	sizeStr;   while ( !found && i<actual ) {//// Extract the point size information.  It is found after the 8th dash.//      name = names[i];      int	pos       = name.PosOf('-');      int	dashCount = (pos>=0) ? 1 : 0;      while ( pos >= 0 && dashCount < 8 ) {	 pos = name.PosOf('-', (u_int)pos+1);	 if ( pos >= 0 ) dashCount++;      }      if ( pos >= 0 && dashCount == 8 ) {	 sizeStr = name.NextWord((u_int)pos+1, '-');	 int	size = atoi(sizeStr);	 found = (size < this->points);      }      if ( found ) fname = name;      else	   i++;   } // End while a smaller font has not been found//// If no font was found, see if there's a smaller pixel size in the list//   i = 0;   while ( !found && i<actual ) {//// Extract the pixel size information.  It is found after the 7th dash.//      name = names[i];      int	pos       = name.PosOf('-');      int	dashCount = (pos>=0) ? 1 : 0;      while ( pos >= 0 && dashCount < 7 ) {	 pos = name.PosOf('-', (u_int)pos+1);	 if ( pos >= 0 ) dashCount++;      }      if ( pos >= 0 && dashCount == 7 ) {	 sizeStr = name.NextWord((u_int)pos+1, '-');	 int	size = atoi(sizeStr);	 found = (size < this->pixels);      }      if ( found ) fname = name;      else	   i++;   } // End while a smaller font has not been found   XFreeFontNames(names);   return found;} // End FindSmaller/*---------------------------------------------------------------------- * Method to return a bold version of the current font */FontDataC*FontDataC::Bold(){   if ( !loaded && !bold ) bold = this;//// See if we already know this//   if ( bold ) return bold;//// See if this is already a bold font//   if ( weight.Equals("bold", IGNORE_CASE) ) {      bold = this;      return bold;   }   if ( debug1 ) cout <<"Looking for a bold font for: " <<name NL;//// See if there is a bold version of this font.//   StringC	bname;   BuildName(foundry, family, "bold", slant, setWidth, addStyle, pixelSize,	     pointSize, resStr, spacing, avgWidth, charset, bname);   if ( FindFont(bname) ) return CreateBold(bname);//// Try a quick "bold" on the end of the name//   bname = name + "*bold";   if ( FindFont(bname) ) return CreateBold(bname);// Any width or add style   BuildName(foundry, family, "bold", slant, "*", "*", pixelSize,   	     pointSize, resStr, spacing, "*", charset, bname);   if ( FindFont(bname) ) return CreateBold(bname);// Any res   BuildName(foundry, family, "bold", slant, "*", "*", pixelSize,   	     pointSize, "*", spacing, "*", charset, bname);   if ( FindFont(bname) ) return CreateBold(bname);// Point size only   BuildName(foundry, family, "bold", slant, "*", "*", "*",   	     pointSize, resStr, spacing, "*", charset, bname);   if ( FindFont(bname) ) return CreateBold(bname);// Any res   BuildName(foundry, family, "bold", slant, "*", "*", "*",   	     pointSize, "*", spacing, "*", charset, bname);   if ( FindFont(bname) ) return CreateBold(bname);// Pixel size only   BuildName(foundry, family, "bold", slant, "*", "*", pixelSize,	     "*", resStr, spacing, "*", charset, bname);   if ( FindFont(bname) ) return CreateBold(bname);// Any res   BuildName(foundry, family, "bold", slant, "*", "*", pixelSize,	     "*", "*", spacing, "*", charset, bname);   if ( FindFont(bname) ) return CreateBold(bname);// Any foundry or family   BuildName("*", "*", "bold", slant, setWidth, addStyle, pixelSize,	     pointSize, resStr, spacing, "*", charset, bname);   if ( FindFont(bname) ) return CreateBold(bname);// Any res   BuildName("*", "*", "bold", slant, setWidth, addStyle, pixelSize,	     pointSize, "*", spacing, "*", charset, bname);   if ( FindFont(bname) ) return CreateBold(bname);// Any width or add style   BuildName("*", "*", "bold", slant, "*", "*", pixelSize,	     pointSize, resStr, spacing, "*", charset, bname);   if ( FindFont(bname) ) return CreateBold(bname);// Any res   BuildName("*", "*", "bold", slant, "*", "*", pixelSize,	     pointSize, "*", spacing, "*", charset, bname);   if ( FindFont(bname) ) return CreateBold(bname);// Point size only   BuildName("*", "*", "bold", slant, "*", "*", "*",	     pointSize, resStr, spacing, "*", charset, bname);   if ( FindFont(bname) ) return CreateBold(bname);// Any res   BuildName("*", "*", "bold", slant, "*", "*", "*",	     pointSize, "*", spacing, "*", charset, bname);   if ( FindFont(bname) ) return CreateBold(bname);// Pixel size only   BuildName("*", "*", "bold", slant, "*", "*", pixelSize,	     "*", resStr, spacing, "*", charset, bname);   if ( FindFont(bname) ) return CreateBold(bname);// Any res   BuildName("*", "*", "bold", slant, "*", "*", pixelSize,	     "*", "*", spacing, "*", charset, bname);   if ( FindFont(bname) ) return CreateBold(bname);//// Try bigger fonts//   BuildName(foundry, family, "bold", slant, setWidth, addStyle, pixelSize,	     pointSize, resStr, spacing, "*", charset, bname);   if ( FindBigger(bname) ) return CreateBold(bname);// Any res   BuildName(foundry, family, "bold", slant, setWidth, addStyle,	     pixelSize, pointSize, "*", spacing, "*", charset, bname);   if ( FindBigger(bname) ) return CreateBold(bname);// Any width or add style   BuildName(foundry, family, "bold", slant, "*", "*", pixelSize,	     pointSize, resStr, spacing, "*", charset, bname);   if ( FindBigger(bname) ) return CreateBold(bname);// Any res   BuildName(foundry, family, "bold", slant, "*", "*", pixelSize,	     pointSize, "*", spacing, "*", charset, bname);   if ( FindBigger(bname) ) return CreateBold(bname);// Point size only   BuildName(foundry, family, "bold", slant, "*", "*", "*",	     pointSize, resStr, spacing, "*", charset, bname);   if ( FindBigger(bname) ) return CreateBold(bname);// Any res   BuildName(foundry, family, "bold", slant, "*", "*", "*",	     pointSize, "*", spacing, "*", charset, bname);   if ( FindBigger(bname) ) return CreateBold(bname);// Pixel size only   BuildName(foundry, family, "bold", slant, "*", "*", pixelSize,	     "*", resStr, spacing, "*", charset, bname);   if ( FindBigger(bname) ) return CreateBold(bname);// Any res   BuildName(foundry, family, "bold", slant, "*", "*", pixelSize,	     "*", "*", spacing, "*", charset, bname);   if ( FindBigger(bname) ) return CreateBold(bname);// Any foundry or family   BuildName("*", "*", "bold", slant, setWidth, addStyle, pixelSize,	     pointSize, resStr, spacing, "*", charset, bname);   if ( FindBigger(bname) ) return CreateBold(bname);// Any res   BuildName("*", "*", "bold", slant, setWidth, addStyle, pixelSize,	     pointSize, "*", spacing, "*", charset, bname);   if ( FindBigger(bname) ) return CreateBold(bname);// Any width or add style   BuildName("*", "*", "bold", slant, "*", "*", pixelSize,	     pointSize, resStr, spacing, "*", charset, bname);   if ( FindBigger(bname) ) return CreateBold(bname);// Any res   BuildName("*", "*", "bold", slant, "*", "*", pixelSize,	     pointSize, "*", spacing, "*", charset, bname);   if ( FindBigger(bname) ) return CreateBold(bname);// Point size only   BuildName("*", "*", "bold", slant, "*", "*", "*",	     pointSize, resStr, spacing, "*", charset, bname);   if ( FindBigger(bname) ) return CreateBold(bname);// Any res   BuildName("*", "*", "bold", slant, "*", "*", "*",	     pointSize, "*", spacing, "*", charset, bname);   if ( FindBigger(bname) ) return CreateBold(bname);// Pixel size only   BuildName("*", "*", "bold", slant, "*", "*", pixelSize,	     "*", resStr, spacing, "*", charset, bname);   if ( FindBigger(bname) ) return CreateBold(bname);// Any res   BuildName("*", "*", "bold", slant, "*", "*", pixelSize,	     "*", "*", spacing, "*", charset, bname);   if ( FindBigger(bname) ) return CreateBold(bname);//// If that didn't work, return this font//#if 0   StringC errmsg("I could not find a bold version of the font: ");   errmsg += name;   halApp->PopupMessage(errmsg);#else   if ( debug1 )      cout <<"I could not find a bold version of the font: " <<name <<endl;#endif   bold = this;   return bold;} // End Bold/*---------------------------------------------------------------------- * Method to create the specified bold font */FontDataC*FontDataC::CreateBold(char *bname){//// Create a new font structure//   if ( debug1 ) cout <<"Found bold font: " <<bname <<endl;   bold = new FontDataC(bname);   if ( !bold->loaded ) {      delete bold;      bold = this;   }   freeBold = True;   return bold;} // End CreateBold/*---------------------------------------------------------------------- * Method to return a non-bold version of the current font */FontDataC*FontDataC::NonBold(){   if ( !loaded && !nonBold ) nonBold = this;//// See if we already know this//   if ( nonBold ) return nonBold;//// See if this is already an italic font//   if ( !weight.Equals("bold", IGNORE_CASE) ) {      nonBold = this;      return nonBold;   }   if ( debug1 ) cout <<"Looking for a non-bold font for: " <<name NL;//// See if there is an medium or regular version of this font.//   StringC	bname;   BuildName(foundry, family, "medium", slant, setWidth, addStyle, pixelSize,	     pointSize, resStr, spacing, avgWidth, charset, bname);   if ( FindFont(bname) ) return CreateNonBold(bname);// Try regular   BuildName(foundry, family, "regular", slant, setWidth, addStyle, pixelSize,	     pointSize, resStr, spacing, avgWidth, charset, bname);   if ( FindFont(bname) ) return CreateNonBold(bname);// Any width or add style   BuildName(foundry, family, "medium", slant, "*", "*", pixelSize,	     pointSize, resStr, spacing, "*", charset, bname);   if ( FindFont(bname) ) return CreateNonBold(bname);// regular   BuildName(foundry, family, "regular", slant, "*", "*", pixelSize,	     pointSize, resStr, spacing, "*", charset, bname);   if ( FindFont(bname) ) return CreateNonBold(bname);// Any res, medium   BuildName(foundry, family, "medium", slant, "*", "*", pixelSize,	     pointSize, "*", spacing, "*", charset, bname);   if ( FindFont(bname) ) return CreateNonBold(bname);// Any res, regular   BuildName(foundry, family, "regular", slant, "*", "*", pixelSize,	     pointSize, "*", spacing, "*", charset, bname);   if ( FindFont(bname) ) return CreateNonBold(bname);// Point size only   BuildName(foundry, family, "medium", slant, "*", "*", "*",	     pointSize, resStr, spacing, "*", charset, bname);   if ( FindFont(bname) ) return CreateNonBold(bname);// regular   BuildName(foundry, family, "regular", slant, "*", "*", "*",	     pointSize, resStr, spacing, "*", charset, bname);   if ( FindFont(bname) ) return CreateNonBold(bname);// Any res, medium   BuildName(foundry, family, "medium", slant, "*", "*", "*",	     pointSize, "*", spacing, "*", charset, bname);   if ( FindFont(bname) ) return CreateNonBold(bname);

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -