[stsf-commit] stsf/stsflib fscomm.c, 1.1, 1.2 fscomm.h, 1.1, 1.2 stsfutil.c, 1.7, 1.8 stsfutil.h, 1.3, 1.4

Alexander Gelfenbain stsf-commit at pdx.freedesktop.org
Sun May 9 16:20:40 PDT 2004


Committed by: adg


Index: fscomm.c
===================================================================
RCS file: /cvs/stsf/stsf/stsflib/fscomm.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- a/fscomm.c	1 May 2004 01:54:27 -0000	1.1
+++ b/fscomm.c	9 May 2004 23:20:37 -0000	1.2
@@ -48,6 +48,19 @@
  */
 
 #include "fscomm.h"
+#include "stsfutil.h"
+
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
+#ifdef HAVE_STRINGS_H
+#include <strings.h>
+#endif
+
+#ifdef NULL
+#undef NULL
+#endif
+
 #define NULL ((void *) 0)
 
 /* [][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][]
@@ -2225,7 +2238,7 @@
 int ci_prefetchglyphs_in(byte *p,
                          uint32_t s,
                          uint32_t count,
-                         STGlyphKey *glyphkeys)
+                         STGlyphKey *gk)
 {
     fsc_prefetchglyphs_in *q = (fsc_prefetchglyphs_in *) p;
     uint32_t curoffs = sizeof(fsc_prefetchglyphs_in);
@@ -2235,14 +2248,14 @@
     q->opcode = FS_PREFETCHGLYPHS_IN;
     q->count = count;
     if (count != 0) {
-        if (glyphkeys == NULL) {
+        if (gk == NULL) {
             return -1;
         }
-        q->glyphkeys = (STGlyphKey *) curoffs;
-        memcpy(p+curoffs, glyphkeys, count * sizeof(STGlyphKey));
+        q->gk = (STGlyphKey *) curoffs;
+        memcpy(p+curoffs, gk, count * sizeof(STGlyphKey));
         /* curoffs += count * sizeof(STGlyphKey); */
     } else {
-        q->glyphkeys = NULL;
+        q->gk = NULL;
     }
     return 0;
 }
@@ -2250,8 +2263,8 @@
                          uint32_t s)
 {
     fsc_prefetchglyphs_in *q = (fsc_prefetchglyphs_in *) p;
-    if (q->glyphkeys != NULL) {
-        q->glyphkeys = (STGlyphKey *) (p + (uintptr_t) q->glyphkeys);
+    if (q->gk != NULL) {
+        q->gk = (STGlyphKey *) (p + (uintptr_t) q->gk);
     }
     return 0;
 }
@@ -2293,8 +2306,161 @@
 /*      GENERIC FUNCTIONS 
  *      ~~~~~~~~~~~~~~~~~
  */
+
+STFSProtoOpcode ProtoOutForIn(STFSProtoOpcode opcode)
+{
+    switch (opcode) {
+        case FS_VERSION_IN:                     return FS_VERSION_IN;
+        case FS_OPEN_IN:                        return FS_OPEN_OUT;
+        case FS_CLOSE_IN:                       return FS_CLOSE_OUT;
+        case FS_GETFONTSFORPLATFORMNAME_IN:     return FS_GETFONTSFORPLATFORMNAME_OUT;
+        case FS_COUNTOBJECTS_IN:                return FS_COUNTOBJECTS_OUT;
+        case FS_FINDOBJECT_IN:                  return FS_FINDOBJECT_OUT;
+        case FS_VERIFYFONTID_IN:                return FS_VERIFYFONTID_OUT;
+        case FS_FINDFONTFAMILY_IN:              return FS_FINDFONTFAMILY_OUT;
+        case FS_GETFONTFAMILIES_IN:             return FS_GETFONTFAMILIES_OUT;
+        case FS_GETFONTFAMILYFONTS_IN:          return FS_GETFONTFAMILYFONTS_OUT;
+        case FS_GETFAMILYNAME_IN:               return FS_GETFAMILYNAME_OUT;
+        case FS_GETTYPEFACENAME_IN:             return FS_GETTYPEFACENAME_OUT;
+        case FS_GETFAMILYFORFONT_IN:            return FS_GETFAMILYFORFONT_OUT;
+        case FS_MAPCHAR_IN:                     return FS_MAPCHAR_OUT;
+        case FS_GETGLYPHMETRICS_IN:             return FS_GETGLYPHMETRICS_OUT;
+        case FS_GETUNSCALEDGLYPHBOUNDS_IN:      return FS_GETUNSCALEDGLYPHBOUNDS_OUT;
+        case FS_GETUNSCALEDGLYPHMETRICS_IN:     return FS_GETUNSCALEDGLYPHMETRICS_OUT;
+        case FS_NEWFONTINSTANCE_IN:             return FS_NEWFONTINSTANCE_OUT;
+        case FS_DISPOSEFONTINSTANCE_IN:         return FS_DISPOSEFONTINSTANCE_OUT;
+        case FS_RENDERGLYPH_IN:                 return FS_RENDERGLYPH_OUT;
+        case FS_GETINSTANCEMETRICS_IN:          return FS_GETINSTANCEMETRICS_OUT;
+        case FS_GETFONTRENDERINGPARAMS_IN:      return FS_GETFONTRENDERINGPARAMS_OUT;
+        case FS_GETFONTTYPE_IN:                 return FS_GETFONTTYPE_OUT;
+        case FS_GETEXTFONTINFO_IN:              return FS_GETEXTFONTINFO_OUT;
+        case FS_GETFONTMETRICS_IN:              return FS_GETFONTMETRICS_OUT;
+        case FS_KERNGLYPHPAIR_IN:               return FS_KERNGLYPHPAIR_OUT;
+        case FS_GETSCALERINFO_IN:               return FS_GETSCALERINFO_OUT;
+        case FS_GETLAYOUTENGINEINFO_IN:         return FS_GETLAYOUTENGINEINFO_OUT;
+        case FS_INSTANCESETSCALERBYTAG_IN:      return FS_INSTANCESETSCALERBYTAG_OUT;
+        case FS_GETFONTURL_IN:                  return FS_GETFONTURL_OUT;
+        case FS_GETFONTSIGNATURE_IN:            return FS_GETFONTSIGNATURE_OUT;
+        case FS_FINDFONTFORSIGNATURE_IN:        return FS_FINDFONTFORSIGNATURE_OUT;
+        case FS_GETFONTDATA_IN:                 return FS_GETFONTDATA_OUT;
+        case FS_LAYOUTCHARS_IN:                 return FS_LAYOUTCHARS_OUT;
+        case FS_CREATEFONTSFROMURL_IN:          return FS_CREATEFONTSFROMURL_OUT;
+        case FS_CREATEFONTS_IN:                 return FS_CREATEFONTS_OUT;
+        case FS_DESTROYFONTS_IN:                return FS_DESTROYFONTS_OUT;
+        case FS_GETFONTSFORURL_IN:              return FS_GETFONTSFORURL_OUT;
+        case FS_GETFONTS_IN:                    return FS_GETFONTS_OUT;
+        case FS_GETNAMETAGS_IN:                 return FS_GETNAMETAGS_OUT;
+        case FS_GETNAMESTRING_IN:               return FS_GETNAMESTRING_OUT;
+        case FS_PREFETCHGLYPHS_IN:              return FS_PREFETCHGLYPHS_OUT;
+        default:                                return FS_PROTO_ERROR;
+    }
+}
+
+
+
+const char *ProtoOpcodeName(STFSProtoOpcode opcode)
+{
+    switch (opcode) {
+        case FS_VERSION_IN:                     return "FS_VERSION_IN";
+        case FS_VERSION_OUT:                    return "FS_VERSION_OUT";
+        case FS_OPEN_IN:                        return "FS_OPEN_IN";
+        case FS_OPEN_OUT:                       return "FS_OPEN_OUT";
+        case FS_CLOSE_IN:                       return "FS_CLOSE_IN";
+        case FS_CLOSE_OUT:                      return "FS_CLOSE_OUT";
+        case FS_GETFONTSFORPLATFORMNAME_IN:     return "FS_GETFONTSFORPLATFORMNAME_IN";
+        case FS_GETFONTSFORPLATFORMNAME_OUT:    return "FS_GETFONTSFORPLATFORMNAME_OUT";
+        case FS_COUNTOBJECTS_IN:                return "FS_COUNTOBJECTS_IN";
+        case FS_COUNTOBJECTS_OUT:               return "FS_COUNTOBJECTS_OUT";
+        case FS_FINDOBJECT_IN:                  return "FS_FINDOBJECT_IN";
+        case FS_FINDOBJECT_OUT:                 return "FS_FINDOBJECT_OUT";
+        case FS_VERIFYFONTID_IN:                return "FS_VERIFYFONTID_IN";
+        case FS_VERIFYFONTID_OUT:               return "FS_VERIFYFONTID_OUT";
+        case FS_FINDFONTFAMILY_IN:              return "FS_FINDFONTFAMILY_IN";
+        case FS_FINDFONTFAMILY_OUT:             return "FS_FINDFONTFAMILY_OUT";
+        case FS_GETFONTFAMILIES_IN:             return "FS_GETFONTFAMILIES_IN";
+        case FS_GETFONTFAMILIES_OUT:            return "FS_GETFONTFAMILIES_OUT";
+        case FS_GETFONTFAMILYFONTS_IN:          return "FS_GETFONTFAMILYFONTS_IN";
+        case FS_GETFONTFAMILYFONTS_OUT:         return "FS_GETFONTFAMILYFONTS_OUT";
+        case FS_GETFAMILYNAME_IN:               return "FS_GETFAMILYNAME_IN";
+        case FS_GETFAMILYNAME_OUT:              return "FS_GETFAMILYNAME_OUT";
+        case FS_GETTYPEFACENAME_IN:             return "FS_GETTYPEFACENAME_IN";
+        case FS_GETTYPEFACENAME_OUT:            return "FS_GETTYPEFACENAME_OUT";
+        case FS_GETFAMILYFORFONT_IN:            return "FS_GETFAMILYFORFONT_IN";
+        case FS_GETFAMILYFORFONT_OUT:           return "FS_GETFAMILYFORFONT_OUT";
+        case FS_MAPCHAR_IN:                     return "FS_MAPCHAR_IN";
+        case FS_MAPCHAR_OUT:                    return "FS_MAPCHAR_OUT";
+        case FS_GETGLYPHMETRICS_IN:             return "FS_GETGLYPHMETRICS_IN";
+        case FS_GETGLYPHMETRICS_OUT:            return "FS_GETGLYPHMETRICS_OUT";
+        case FS_GETUNSCALEDGLYPHBOUNDS_IN:      return "FS_GETUNSCALEDGLYPHBOUNDS_IN";
+        case FS_GETUNSCALEDGLYPHBOUNDS_OUT:     return "FS_GETUNSCALEDGLYPHBOUNDS_OUT";
+        case FS_GETUNSCALEDGLYPHMETRICS_IN:     return "FS_GETUNSCALEDGLYPHMETRICS_IN";
+        case FS_GETUNSCALEDGLYPHMETRICS_OUT:    return "FS_GETUNSCALEDGLYPHMETRICS_OUT";
+        case FS_NEWFONTINSTANCE_IN:             return "FS_NEWFONTINSTANCE_IN";
+        case FS_NEWFONTINSTANCE_OUT:            return "FS_NEWFONTINSTANCE_OUT";
+        case FS_DISPOSEFONTINSTANCE_IN:         return "FS_DISPOSEFONTINSTANCE_IN";
+        case FS_DISPOSEFONTINSTANCE_OUT:        return "FS_DISPOSEFONTINSTANCE_OUT";
+        case FS_RENDERGLYPH_IN:                 return "FS_RENDERGLYPH_IN";
+        case FS_RENDERGLYPH_OUT:                return "FS_RENDERGLYPH_OUT";
+        case FS_GETINSTANCEMETRICS_IN:          return "FS_GETINSTANCEMETRICS_IN";
+        case FS_GETINSTANCEMETRICS_OUT:         return "FS_GETINSTANCEMETRICS_OUT";
+        case FS_GETFONTRENDERINGPARAMS_IN:      return "FS_GETFONTRENDERINGPARAMS_IN";
+        case FS_GETFONTRENDERINGPARAMS_OUT:     return "FS_GETFONTRENDERINGPARAMS_OUT";
+        case FS_GETFONTTYPE_IN:                 return "FS_GETFONTTYPE_IN";
+        case FS_GETFONTTYPE_OUT:                return "FS_GETFONTTYPE_OUT";
+        case FS_GETEXTFONTINFO_IN:              return "FS_GETEXTFONTINFO_IN";
+        case FS_GETEXTFONTINFO_OUT:             return "FS_GETEXTFONTINFO_OUT";
+        case FS_GETFONTMETRICS_IN:              return "FS_GETFONTMETRICS_IN";
+        case FS_GETFONTMETRICS_OUT:             return "FS_GETFONTMETRICS_OUT";
+        case FS_KERNGLYPHPAIR_IN:               return "FS_KERNGLYPHPAIR_IN";
+        case FS_KERNGLYPHPAIR_OUT:              return "FS_KERNGLYPHPAIR_OUT";
+        case FS_GETSCALERINFO_IN:               return "FS_GETSCALERINFO_IN";
+        case FS_GETSCALERINFO_OUT:              return "FS_GETSCALERINFO_OUT";
+        case FS_GETLAYOUTENGINEINFO_IN:         return "FS_GETLAYOUTENGINEINFO_IN";
+        case FS_GETLAYOUTENGINEINFO_OUT:        return "FS_GETLAYOUTENGINEINFO_OUT";
+        case FS_INSTANCESETSCALERBYTAG_IN:      return "FS_INSTANCESETSCALERBYTAG_IN";
+        case FS_INSTANCESETSCALERBYTAG_OUT:     return "FS_INSTANCESETSCALERBYTAG_OUT";
+        case FS_GETFONTURL_IN:                  return "FS_GETFONTURL_IN";
+        case FS_GETFONTURL_OUT:                 return "FS_GETFONTURL_OUT";
+        case FS_GETFONTSIGNATURE_IN:            return "FS_GETFONTSIGNATURE_IN";
+        case FS_GETFONTSIGNATURE_OUT:           return "FS_GETFONTSIGNATURE_OUT";
+        case FS_FINDFONTFORSIGNATURE_IN:        return "FS_FINDFONTFORSIGNATURE_IN";
+        case FS_FINDFONTFORSIGNATURE_OUT:       return "FS_FINDFONTFORSIGNATURE_OUT";
+        case FS_GETFONTDATA_IN:                 return "FS_GETFONTDATA_IN";
+        case FS_GETFONTDATA_OUT:                return "FS_GETFONTDATA_OUT";
+        case FS_LAYOUTCHARS_IN:                 return "FS_LAYOUTCHARS_IN";
+        case FS_LAYOUTCHARS_OUT:                return "FS_LAYOUTCHARS_OUT";
+        case FS_CREATEFONTSFROMURL_IN:          return "FS_CREATEFONTSFROMURL_IN";
+        case FS_CREATEFONTSFROMURL_OUT:         return "FS_CREATEFONTSFROMURL_OUT";
+        case FS_CREATEFONTS_IN:                 return "FS_CREATEFONTS_IN";
+        case FS_CREATEFONTS_OUT:                return "FS_CREATEFONTS_OUT";
+        case FS_DESTROYFONTS_IN:                return "FS_DESTROYFONTS_IN";
+        case FS_DESTROYFONTS_OUT:               return "FS_DESTROYFONTS_OUT";
+        case FS_GETFONTSFORURL_IN:              return "FS_GETFONTSFORURL_IN";
+        case FS_GETFONTSFORURL_OUT:             return "FS_GETFONTSFORURL_OUT";
+        case FS_GETFONTS_IN:                    return "FS_GETFONTS_IN";
+        case FS_GETFONTS_OUT:                   return "FS_GETFONTS_OUT";
+        case FS_GETNAMETAGS_IN:                 return "FS_GETNAMETAGS_IN";
+        case FS_GETNAMETAGS_OUT:                return "FS_GETNAMETAGS_OUT";
+        case FS_GETNAMESTRING_IN:               return "FS_GETNAMESTRING_IN";
+        case FS_GETNAMESTRING_OUT:              return "FS_GETNAMESTRING_OUT";
+        case FS_PREFETCHGLYPHS_IN:              return "FS_PREFETCHGLYPHS_IN";
+        case FS_PREFETCHGLYPHS_OUT:             return "FS_PREFETCHGLYPHS_OUT";
+        default:                                return "*** UNKNOWN ***";
+    }
+}
+
+
 int fsc_copyout(STFSProtoOpcode opcode, byte *p, uint32_t s)
 {
+    /* all protocol requests start with STFSProtoOpcode */
+    fsc_terminate_in *q = (fsc_terminate_in *) p;
+
+    if (q->opcode != opcode) {
+        ErrorStr("%s: inconsistent opcode: %s passed in; %s stored in the protocol buffer",
+                 __func__, ProtoOpcodeName(opcode), ProtoOpcodeName(q->opcode));
+        return -2;
+    }
+    
     switch (opcode) {
         case FS_VERSION_IN:                     return co_version_in(p, s);
         case FS_VERSION_OUT:                    return co_version_out(p, s);

Index: fscomm.h
===================================================================
RCS file: /cvs/stsf/stsf/stsflib/fscomm.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- a/fscomm.h	1 May 2004 01:54:27 -0000	1.1
+++ b/fscomm.h	9 May 2004 23:20:37 -0000	1.2
@@ -53,6 +53,8 @@
 #include <sttypes.h>
 #include <stprivate.h>
 
+#define STFS_PROTOCOL_VERSION 6
+
 /*
  * "IN" direction is from STSF Client Library to STSF Font Server
  * "OUT" direction is from STSF Font Server to STSF Client Library
@@ -63,6 +65,7 @@
 #define outdef(a) FS_##a##_OUT
 
 typedef enum {
+    FS_PROTO_ERROR = -1,
     FS_TERMINATE_IN = 0,
 
     protopair(VERSION),
@@ -775,7 +778,7 @@
     STFSProtoOpcode opcode;
 
     uint32_t count;
-    STGlyphKey *glyphkeys;  /* [count] */
+    STGlyphKey *gk;  /* [count] */
 } fsc_prefetchglyphs_in;
 
 typedef struct {
@@ -809,6 +812,18 @@
 int ci_open_out(byte *p,
                 uint32_t s);
 
+int ci_close_in(byte *p, 
+                uint32_t s);
+
+int co_close_in(byte *p,
+                uint32_t s);
+
+int ci_close_out(byte *p, 
+                 uint32_t s);
+
+int co_close_out(byte *p,
+                 uint32_t s);
+
 int ci_getfontsforplatformname_in(byte *p,
                                   uint32_t s,
                                   STCharCount namelen,
@@ -1193,7 +1208,7 @@
                        STCount count,
                        STNameTag *tags);
 
-int ci_getnamesting_in(byte *p,
+int ci_getnamestring_in(byte *p,
                        uint32_t s,
                        STFont font,
                        STNameTag *tag);
@@ -1214,6 +1229,94 @@
                           uint32_t *offsets);
 
 
+int fsc_copyout(STFSProtoOpcode opcode, byte *p, uint32_t s);
+
+
+STFSProtoOpcode ProtoOutForIn(STFSProtoOpcode opcode);
+
+
+/* Metaprotocol */
+
+#if defined (SOLARIS_DOORS)
+
+typedef enum {
+    CONNECT = 0,        /* CONNECT request from the client is expected */
+    VERIFY = 1,         /* VERIFY request from the client is expected */
+    PROTOCOL = 2        /* PROTOCOL request from the client is expected */
+} FSProtoState;
+
+    
+/* Initial handshake */
+
+typedef struct {
+    uint64_t cid;
+    int major;                  /* Client STSF version major */
+    int minor;                  /* Client STSF version minor */  
+    int update;                 /* Client STSF version update */ 
+    int proto;                  /* Client STSF protocol version */ 
+} DoorHandshakeIn;
+
+typedef struct {
+    STStatus ret;
+    int major;                  /* Server STSF version major */
+    int minor;                  /* Server STSF version minor */  
+    int update;                 /* Server STSF version update */ 
+    int proto;                  /* Server STSF protocol version */ 
+    // char doorpath[PATH_MAX];    /* Pathname to the private door allocated for the client */
+} DoorHandshakeOut;
+
+
+/* CONNECT */
+typedef struct {
+    int payloadsize;
+} ConnectIn;
+
+typedef struct {
+    uint32_t memsize;            
+} ConnectOut;
+
+/* VERIFY */
+typedef struct {
+    int dummy;
+} VerifyIn;
+
+typedef struct {
+    int dummy;
+} VerifyOut;
+
+/* PROTOCOL */
+typedef struct {
+    STFSProtoOpcode opcode;
+} ProtoIn;
+
+typedef struct {
+    STFSProtoOpcode opcode;    
+} ProtoOut;
+
+typedef struct {
+    FSProtoState state;
+    union {
+        ConnectIn   c;
+        VerifyIn    v;
+        ProtoIn     p;
+    } x;
+} DoorRequestIn;
+
+typedef struct {
+    uint64_t cid;           /* font server always returns client's CID */
+    STStatus ret;
+    union {
+        ConnectOut  c;
+        VerifyOut   v;
+        ProtoOut    p;
+    } x;
+} DoorRequestOut;
+
+#define DOORBUFMAXSIZE  128      /* big enough to hold all data structures declared aboved and 
+                                    file descriptors returned by the server */
+
+
+#endif
 
 
 

Index: stsfutil.c
===================================================================
RCS file: /cvs/stsf/stsf/stsflib/stsfutil.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- a/stsfutil.c	22 Apr 2004 20:56:32 -0000	1.7
+++ b/stsfutil.c	9 May 2004 23:20:37 -0000	1.8
@@ -116,6 +116,11 @@
  */
 static int initialized = 0;
 
+
+static const utf16 SURROGATE_HIGH_START  = 0xD800UL;
+static const utf16 SURROGATE_HIGH_END    = 0xDBFFUL;
+
+
 static char *StrCaseStr(const char *s1, const char *s2)
 {
   while(*s1) {
@@ -751,6 +756,7 @@
     if (familyname_pos != NULL)     free(familyname_pos);
 }
 
+#if 0
 void PHeaderDump(STFSDirection direction, void *pheader)
 {
     uint16_t *c16 = (uint16_t*) pheader;
@@ -774,6 +780,7 @@
 
     fprintf(DebugFile, "len: %d]\n", c16[PACLEN]);
 }
+#endif
     
 
 
@@ -1214,6 +1221,54 @@
     return p;
 }
 
+int CountUTF16Bytes(utf16 *iString, STCharCount iCharCount, STCharCount iStart, int *oStartOffset)
+{
+    int offset = 0;
+    int count = 0;
+    int i = 0;
+
+    if (iString == NULL) return 0;
+
+    while (iStart) {
+        if (iString[i] >= SURROGATE_HIGH_START && iString[i] <= SURROGATE_HIGH_END) i++;
+        i++;
+        iStart--;
+    }
+
+    offset = i+i;
+
+    while (iCharCount) {
+        if (iString[i] >= SURROGATE_HIGH_START && iString[i] <= SURROGATE_HIGH_END) i++;
+        i++;
+        iCharCount--;
+    }
+
+    count = i+i - offset;
+
+    if (oStartOffset) *oStartOffset = offset;
+
+    return count;
+}
+
+/* Counts UTF16 characters in a UTF-16 string pointed to by str that contains ucount UTF-16 elements */
+int CountUTF16Chars(utf16 *str, int ucount)
+{
+    int count = 0;
+    utf16 *p = str;
+
+    while (ucount > 1) {
+        if (*p < SURROGATE_HIGH_START || *p > SURROGATE_HIGH_END) {
+            count++;
+        }
+        p++;
+        ucount--;
+    }
+    return count;
+}
+            
+        
+
+
 void GetRandomBytes(int count, byte *p)
 {
     int fd=open("/dev/urandom", O_RDONLY | O_NONBLOCK);

Index: stsfutil.h
===================================================================
RCS file: /cvs/stsf/stsf/stsflib/stsfutil.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- a/stsfutil.h	8 Apr 2004 06:30:17 -0000	1.3
+++ b/stsfutil.h	9 May 2004 23:20:37 -0000	1.4
@@ -54,7 +54,7 @@
 
 #include "sttypes.h"
 #include "fontserver.h"
-#include "stfsproto.h"
+/* #include "stfsproto.h" */
 
 #ifdef __cplusplus
 extern "C" {
@@ -123,10 +123,17 @@
 /* Expands an array of Latin-1 characters to UTF-16 and allocates memory for it */
 utf16 *ExpandChars(const char *str, size_t charcnt);
 
+/* returns the number of bytes in a substring of a UTF16 string that starts at character
+   position iStart. If iStartOffset is not NULL, the byte offset of the iStart UTF-16 character
+   is stored there */
+int CountUTF16Bytes(utf16 *iString, STCharCount iStart, STCharCount iCharCount, int *oStartOffset);
+
+/* Counts UTF16 characters in a UTF-16 string pointed to by str that contains ucount UTF-16 elements */
+int CountUTF16Chars(utf16 *str, int ucount);
+
 void ParseTypefaceName(const char *typeface,
                        STFontWeightClass *weight, STFontWidthClass *width, STFontStyle *style);
 
-
 /* Parses the Type1 names: /FullName, /FamilyName, and /FontName and generates STSF family-subfamily pair */
 void GuessType1Names(const char *fullname, const char *familyname, const char *fontname, char **stfamily, char **stsubfamily);
 
@@ -139,7 +146,9 @@
 const char *STFontWidthClassName(STFontWidthClass c);
 const char *STFontStyleName(STFontStyle c);
 
+#if 0
 void PHeaderDump(STFSDirection direction, void *pheader);
+#endif
 
 
 




More information about the stsf-commit mailing list