open-src/proto/Fonts/Xsun-findfont.patch
author Alan Coopersmith <Alan.Coopersmith@Sun.COM>
Mon, 12 Jun 2006 16:04:09 -0700
changeset 32 235a80428f96
permissions -rw-r--r--
6437461: Xorg modularization: common extension protocols

Font header changes required for Xsun to maintain libfont ABI compatibility and
fix for:
	4424766 Xsun should select fonts more intelligently
	<http://bugs.opensolaris.org/bugdatabase/view_bug.do?bug_id=4424766>

--- font.h	Wed Apr 19 11:54:33 2006
+++ font.h	Wed Apr 19 13:54:56 2006
@@ -24,6 +24,40 @@
 /* $XFree86: xc/include/fonts/font.h,v 3.4 2000/11/27 00:10:02 dawes Exp $ */
 /* $NCDXorg: @(#)font.h,v 1.7 1991/06/24 17:00:23 lemke Exp $ */
 
+#ifdef XSUN
+/************************************************************************
+ * Xsun additions for preferring non-scaled bitmaps (not used in Xorg
+ * which has a different mechanism using font path names)
+ *
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, and/or sell copies of the Software, and to permit persons
+ * to whom the Software is furnished to do so, provided that the above
+ * copyright notice(s) and this permission notice appear in all copies of
+ * the Software and that both the above copyright notice(s) and this
+ * permission notice appear in supporting documentation.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
+ * OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+ * HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
+ * INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Except as contained in this notice, the name of a copyright holder
+ * shall not be used in advertising or otherwise to promote the sale, use
+ * or other dealings in this Software without prior written authorization
+ * of the copyright holder.
+ */
+#endif /* XSUN */
+
 #ifndef FONT_H
 #define FONT_H
 
@@ -76,6 +110,11 @@
 #define	BadCharRange	87
 #define	BadFontFormat	88
 #define	FPEResetFailed	89	/* for when an FPE reset won't work */
+#ifdef XSUN
+#define FontNameScalable 90
+#define FontNameBitmap   91
+#define FontNameMatch    92
+#endif
 
 /* OpenFont flags */
 #define FontLoadInfo	0x0001
@@ -96,7 +135,11 @@
 #define CACHING_OFF 0
 #define CACHE_16_BIT_GLYPHS 1
 #define CACHE_ALL_GLYPHS 2
+#ifdef XSUN
+#define DEFAULT_GLYPH_CACHING_MODE CACHING_OFF
+#else
 #define DEFAULT_GLYPH_CACHING_MODE CACHE_16_BIT_GLYPHS
+#endif
 extern int glyphCachingMode;
 
 struct _Client;

--- fontproto.h	Wed Apr 19 11:54:33 2006
+++ fontproto.h	Wed Apr 19 13:55:08 2006
@@ -22,6 +22,41 @@
 authorization from The XFree86 Project Inc..
 
 */
+#ifdef XSUN
+/************************************************************************
+ * Xsun additions for preferring non-scaled bitmaps (not used in Xorg
+ * which has a different mechanism using font path names)
+ *
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, and/or sell copies of the Software, and to permit persons
+ * to whom the Software is furnished to do so, provided that the above
+ * copyright notice(s) and this permission notice appear in all copies of
+ * the Software and that both the above copyright notice(s) and this
+ * permission notice appear in supporting documentation.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
+ * OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+ * HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
+ * INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Except as contained in this notice, the name of a copyright holder
+ * shall not be used in advertising or otherwise to promote the sale, use
+ * or other dealings in this Software without prior written authorization
+ * of the copyright holder.
+ */
+#endif /* XSUN */
+
+
 #ifndef _FONTPROTO_H
 #define _FONTPROTO_H
 
@@ -41,8 +76,14 @@
 				  LoadGlyphsFunc load_glyphs, 
 				  StartLaFunc start_list_alias_func, 
 				  NextLaFunc next_list_alias_func, 
+#ifdef XSUN
+				  SetPathFunc set_path_func,
+  				  FindFontFunc find_font_fonc);
+#else
 				  SetPathFunc set_path_func);
+#endif
 
+
 extern int GetDefaultPointSize ( void );
 
 extern int init_fs_handlers ( FontPathElementPtr fpe, 

--- fontstruct.h	Wed Apr 19 11:54:33 2006
+++ fontstruct.h	Wed Apr 19 13:55:49 2006
@@ -23,6 +23,41 @@
 ******************************************************************/
 /* $XFree86: xc/include/fonts/fontstruct.h,v 3.3 1999/08/21 13:47:34 dawes Exp $ */
 
+#ifdef XSUN
+/************************************************************************
+ * Xsun additions for preferring non-scaled bitmaps (not used in Xorg
+ * which has a different mechanism using font path names) and preserving
+ * binary compatibility with existing Xsun/libfont ABI.
+ *
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, and/or sell copies of the Software, and to permit persons
+ * to whom the Software is furnished to do so, provided that the above
+ * copyright notice(s) and this permission notice appear in all copies of
+ * the Software and that both the above copyright notice(s) and this
+ * permission notice appear in supporting documentation.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
+ * OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+ * HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
+ * INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
+ * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Except as contained in this notice, the name of a copyright holder
+ * shall not be used in advertising or otherwise to promote the sale, use
+ * or other dealings in this Software without prior written authorization
+ * of the copyright holder.
+ */
+#endif /* XSUN */
+
 #ifndef FONTSTR_H
 #define FONTSTR_H
 
@@ -122,7 +157,10 @@
 				unsigned long * /* count */,
 				xCharInfo **    /* glyphs */);
     void        (*unload_font) (FontPtr         /* font */);
+#ifndef XSUN
+/* Moved to the end to preserve binary compatibility. */
     void        (*unload_glyphs) (FontPtr         /* font */);
+#endif
     FontPathElementPtr fpe;
     pointer     svrPrivate;
     pointer     fontPrivate;
@@ -129,6 +167,10 @@
     pointer     fpePrivate;
     int		maxPrivate;
     pointer	*devPrivates;
+#ifdef XSUN
+/* Moved to the end to preserve binary compatibility. */
+    void        (*unload_glyphs) (FontPtr         /* font */);
+#endif
 }           FontRec;
 
 #define FontGetPrivate(pFont,n) ((n) > (pFont)->maxPrivate ? (pointer) 0 : \
@@ -222,6 +264,19 @@
 
 typedef void (*SetPathFunc)(void);
 
+#ifdef XSUN
+typedef int (*FindFontFunc) ( pointer client,
+			      FontPathElementPtr fpe,
+			      Mask flags,
+			      char* name,
+			      int namelen,
+			      fsBitmapFormat format,
+			      fsBitmapFormatMask fmask,
+			      XID id,
+			      char** aliasName,
+			      FontPtr non_cachable_font);
+#endif
+
 typedef struct _FPEFunctions {
     NameCheckFunc       name_check;
     InitFpeFunc 	init_fpe;
@@ -246,6 +301,9 @@
 			data = list of fsChar2b's */
     LoadGlyphsFunc	load_glyphs;
     SetPathFunc		set_path_hook;
+#ifdef XSUN
+    FindFontFunc	find_font;
+#endif
 } FPEFunctionsRec, FPEFunctions;
 
 /*