[poppler] Fontconfig patch

Albert Astals Cid aacid at kde.org
Thu Jul 21 02:36:31 EST 2005


A Dimecres 20 Juliol 2005 12:02, vàreu escriure:
> Hi,
>
> Albert Astals Cid schrieb:
> > Ok, here it goes again the patch with the fixes from Jeff about styling
> > and the h - name thing, the fix for Brad if BOOK is not defined and the
> > fix for Stefan so he can define and extern fontconfig configuration
> > object.
> >
> > More comments?
> >
> > [SNIP]
> >>-     but that matches windows ttf which gets wrong encoding */
> >>-  {"Symbol",                "Standard Symbols L,Symbol"},
>
> We should test if we need a special workaround for the "Symbol" font in
> the new fontconfig code too. As written in the comment, I had just
> stolen the patterns from mupdf. I never tested the old code with the
> Symbol font.

Well on my system 

$ fc-match Symbol
s050000l.pfb: "Standard Symbols L" "Regular"

>
> >>  [SNIP]
> >>       } else if (!cmd->cmp("displayCIDFontTT")) {
> >>-	parseDisplayFont(tokens, displayCIDFonts,
> >>-			 displayFontTT, fileName, line);
> >>+// 	parseDisplayFont(tokens, displayCIDFonts,
> >>+// 			 displayFontTT, fileName, line);
> >>       } else if (!cmd->cmp("psFile")) {
> >> 	parsePSFile(tokens, fileName, line);
> >>       } else if (!cmd->cmp("psFont")) {
>
> Why do you leave the comments? After all the parseDisplayFont function
> exists no longer. Maybe just a "// deprecated" comment.
Ok, the if have to be there because if not you'll get a unknown command 
displayNamedCIDFontTT error, but i can remove the things inside the if.

>
> >>+FcPattern *buildFcPattern(GfxFont *font)
> >>+{
> >>+  int weight = FC_WEIGHT_NORMAL,
> >>+      slant = FC_SLANT_ROMAN,
> >>+      width = FC_WIDTH_NORMAL,
> >>+      spacing = FC_PROPORTIONAL;
> >>+  bool deleteFamily = false;
> >>+  char *family, *name, *lang, *aux = NULL;
> >>+  const char *h = NULL;
> >>+  FcPattern *p;
> >>
> >>-  lockGlobalParams;
> >>-  dfp = (DisplayFontParam *)displayFonts->lookup(fontName);
> >>-  unlockGlobalParams;
> >>-  return dfp;
> >>+  // this is all heuristics will be overwritten if font had proper info
> >>+  name = font->getName()->getCString();
>
> Can getName() return NULL?
I would say no, the only fonts that don't have name are Type 3 fonts but they 
never reach that part of the code. But i can write a guard if you think it's 
necessary.

>
> >>+  // find the language we want the font to support
> >>+  if (font->isCIDFont())
> >>+  {
> >>+    GooString *collection = ((GfxCIDFont *)font)->getCollection();
> >>+    if (collection)
> >>+    {
> >>+      if (strcmp(collection->getCString(), "Adobe-GB1") == 0)
> >>+        lang = "zh-cn"; // Simplified Chinese
> >>+      else if (strcmp(collection->getCString(), "Adobe-CNS1") == 0)
> >>+        lang = "zh-tw"; // Traditional Chinese
> >>+      else if (strcmp(collection->getCString(), "Adobe-Japan1") == 0)
> >>+        lang = "ja"; // Japanese
> >>+      else if (strcmp(collection->getCString(), "Adobe-Japan2") == 0)
> >>+        lang = "ja"; // Japanese
> >>+      else if (strcmp(collection->getCString(), "Adobe-Korea1") == 0)
> >>+        lang = "ko"; // Korean
> >>+      else
>
> Can "Adobe-Identity" or "Adobe-UCS" happen here? If so, I guess they
> should be lang = "xx", without the error.
Right, added to my local copy.

Albert

>
> Regards,
>
> Martin

		
______________________________________________ 
Renovamos el Correo Yahoo! 
Nuevos servicios, más seguridad 
http://correo.yahoo.es


More information about the poppler mailing list