Sisyphus repositório
Última atualização: 1 outubro 2023 | SRPMs: 18631 | Visitas: 37736298
en ru br
ALT Linux repositórios
S:2.4.7-alt1
5.0: 1.3.10-alt1
4.1: 1.3.10-alt0.M41.4
+updates:1.3.9-alt1.M41.1
4.0: 1.2.12-alt6.M40.9
+updates:1.2.12-alt6.M40.8
3.0: 1.1.20-alt14.1

Group :: Sistema/Servidores
RPM: cups

 Main   Changelog   Spec   Patches   Sources   Download   Gear   Bugs e FR  Repocop 

Patch: cups-1.3.3-asp-alt-texttops.patch
Download


diff -Naur cups-1.3.3.orig/filter/texttops.c cups-1.3.3/filter/texttops.c
--- cups-1.3.3.orig/filter/texttops.c	2007-07-12 01:46:42 +0400
+++ cups-1.3.3/filter/texttops.c	2007-10-01 07:00:05 +0400
@@ -45,6 +45,22 @@
 int		Directions[256];/* Text directions for each font */
 
 
+/**
+ * convert font name to appropriate nimbus font
+ */
+const char *nimbus_name(const char* font)
+{
+    if (!strcmp(font,"Courier"))
+	return	"NimbusMonL-Regu";
+    else if(!strcmp(font,"Courier-Bold"))
+	return "NimbusMonL-Bold";
+    else if(!strcmp(font,"Courier-Oblique"))
+	return "NimbusMonL-ReguObli";
+    else if(!strcmp(font,"Courier-BoldOblique"))
+	return "NimbusMonL-BoldObli";
+    else
+	return font;
+}
 /*
  * Local functions...
  */
@@ -143,7 +159,10 @@
 		  "cupsBold",
 		  "cupsItalic"
 		};
-
+  static char	*hex = "0123456789abcdef";
+  int		res, inp1, inp2, len, count;
+  char		*hexp, *inp;	/* Pointers to hexline/line buffers */
+  char		hexline[1024];	/* Hex buffer for *.pfb binary section */
 
  /*
   * Get the data directory...
@@ -735,12 +754,56 @@
       /**** MRS: Need to use CUPS_FONTPATH env var! ****/
       /**** Also look for Fontmap file or name.pfa, name.pfb... ****/
       snprintf(filename, sizeof(filename), "%s/fonts/%s", datadir, fonts[i]);
-      if ((fp = fopen(filename, "rb")) != NULL)
-      {
-        while ((j = fread(line, 1, sizeof(line), fp)) > 0)
-	  fwrite(line, 1, j, stdout);
-
-	fclose(fp);
+      if ((fp = fopen(filename, "rb")) != NULL) {
+	    inp1 = fgetc(fp);
+	    if (inp1 != 0x80) /*pfa font file*/
+	    {
+	        fputc(inp1,stdout);
+			while (fgets(line, sizeof(line), fp) != NULL)
+	    	    fputs(line,stdout);
+	    } 
+      else  /*pfb font file */
+	    while (inp2=fgetc(fp))
+	    {
+		if (inp2 < 0x04) {
+		    if (inp2 != 0x03) {
+			len = fgetc(fp) & 0xff;
+			len |= (fgetc(fp) & 0xff) << 8;
+			len |= (fgetc(fp) & 0xff) << 16;
+			len |= (fgetc(fp) & 0xff) << 24;
+			while  (len >0 )
+			{
+			    count = (len>512 ? 512 : len);
+			    res = fread(line, 1, count, fp);
+			    if (res != count)
+				len = res;
+			    if (inp2 == 0x01) 
+				fwrite(line,1,res,stdout);
+			    else 
+			    {
+				hexp=hexline;
+				for (inp=line; inp-line<res; inp++)
+				{
+				    *hexp++ =hex[(*inp >> 4) & 0xf];
+				    *hexp++ =hex[*inp & 0xf];
+				}
+				fwrite(hexline,1,(2*res),stdout);
+			    }
+			    len -=res;
+			}
+			fputc(0x0a,stdout);
+		    }
+		else break;
+	     }
+	    else {
+		fprintf (stderr, "ERROR: Wrong pfb font file %s\n",filename);
+	        fclose (fp);
+		exit(1);
+	    }
+	    if (!fgetc(fp))
+		break;
+	}
+    	    fclose(fp); 
       }
 
       puts("\n%%EndResource");
@@ -787,7 +850,7 @@
 
     for (i = PrettyPrint ? 2 : 1; i >= 0; i --)
     {
-      printf("/%s findfont\n", Fonts[0][i]);
+      printf("/%s findfont\n", nimbus_name(Fonts[0][i]));
       puts("dup length 1 add dict begin\n"
 	   "	{ 1 index /FID ne { def } { pop pop } ifelse } forall\n"
 	   "	/Encoding cupsEncoding00 def\n"
@@ -807,7 +870,7 @@
     for (i = PrettyPrint ? 2 : 1; i >= 0; i --)
       for (j = 0; j < NumFonts; j ++)
       {
-	printf("/%s findfont\n", Fonts[j][i]);
+	printf("/%s findfont\n", nimbus_name(Fonts[j][i]));
 	printf("dup length 1 add dict begin\n"
 	       "	{ 1 index /FID ne { def } { pop pop } ifelse } forall\n"
 	       "	/Encoding cupsEncoding%02x def\n"
 
projeto & código: Vladimir Lettiev aka crux © 2004-2005, Andrew Avramenko aka liks © 2007-2008
mantenedor atual: Michael Shigorin
mantenedor da tradução: Fernando Martini aka fmartini © 2009