[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Dotgnu-pnet-commits] pnetlib/Xsharp XsharpPCF.c, NONE, 1.1 XsharpSuppor
From: |
Rhys Weatherley <address@hidden> |
Subject: |
[Dotgnu-pnet-commits] pnetlib/Xsharp XsharpPCF.c, NONE, 1.1 XsharpSupport.h, NONE, 1.1 Makefile.am, 1.7, 1.8 XsharpSupport.c, 1.27, 1.28 |
Date: |
Mon, 01 Dec 2003 02:48:44 +0000 |
Update of /cvsroot/dotgnu-pnet/pnetlib/Xsharp
In directory subversions:/tmp/cvs-serv30875/Xsharp
Modified Files:
Makefile.am XsharpSupport.c
Added Files:
XsharpPCF.c XsharpSupport.h
Log Message:
Check in the beginnings of the client-side PCF font rendering engine.
Index: Makefile.am
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/Xsharp/Makefile.am,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** Makefile.am 27 Nov 2003 01:00:59 -0000 1.7
--- Makefile.am 1 Dec 2003 02:48:42 -0000 1.8
***************
*** 5,9 ****
xsupport_LTLIBRARIES = libXsharpSupport.la
! libXsharpSupport_la_SOURCES = XsharpSupport.c
libXsharpSupport_la_LDFLAGS = -version-info 0:0:0 -no-undefined \
$(X_LIBS)
$(X_PRE_LIBS) $(XFT_LIB) \
--- 5,9 ----
xsupport_LTLIBRARIES = libXsharpSupport.la
! libXsharpSupport_la_SOURCES = XsharpSupport.c XsharpSupport.h XsharpPCF.c
libXsharpSupport_la_LDFLAGS = -version-info 0:0:0 -no-undefined \
$(X_LIBS)
$(X_PRE_LIBS) $(XFT_LIB) \
--- NEW FILE: XsharpPCF.c ---
/*
* XsharpPCF.c - C support code for client-side rendering of PCF fonts.
*
* Copyright (C) 2003 Southern Storm Software, Pty Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#if !defined(X_DISPLAY_MISSING) && HAVE_SELECT
#include "XsharpSupport.h"
/*
* Format flags for PCF files.
*/
#define PCF_DEFAULT_FORMAT 0x00000000
#define PCF_INKBOUNDS 0x00000200
#define PCF_ACCEL_W_INKBOUNDS 0x00000100
#define PCF_COMPRESSED_METRICS 0x00000100
#define PCF_BYTEORDER_MSBFIRST 0x00000004
#define PCF_BITORDER_MSBFIRST 0x00000008
/*
* Table types for PCF files.
*/
#define PCF_PROPERTIES (1<<0)
#define PCF_ACCELERATORS (1<<1)
#define PCF_METRICS (1<<2)
#define PCF_BITMAPS (1<<3)
#define PCF_INK_METRICS (1<<4)
#define PCF_BDF_ENCODINGS (1<<5)
#define PCF_SWIDTHS (1<<6)
#define PCF_GLYPH_NAMES (1<<7)
#define PCF_BDF_ACCELERATORS (1<<8)
/*
* Information about a PCF font image once it has been loaded into memory.
* This is independent of the screen and can be shared between multiple
* instances of "PCFFontRenderer".
*/
typedef struct
{
XFontStruct fs;
unsigned char *data;
unsigned long length;
unsigned long posn;
int format;
int numGlyphs;
int glyphFormat;
unsigned char **glyphs;
} PCFFontImage;
/*
* Information that is used to render a PCF font to a screen.
*/
typedef struct
{
PCFFontImage *image;
XImage *ximage;
Pixmap stipple;
GC stippleGC;
} PCFFontRenderer;
/*
* Read an 8-bit value from the current position in a PCF font image.
*/
static int PCFReadInt8(PCFFontImage *image)
{
if(image->posn < image->length)
{
return (int)(image->data[(image->posn)++]);
}
else
{
return 0;
}
}
/*
* Read a 16-bit value from the current position in a PCF font image.
*/
static int PCFReadInt16(PCFFontImage *image)
{
int byte1 = PCFReadInt8(image);
int byte2 = PCFReadInt8(image);
if((image->format & PCF_BYTEORDER_MSBFIRST) != 0)
{
return (int)(short)((byte1 << 8) | byte2);
}
else
{
return (int)(short)((byte2 << 8) | byte1);
}
}
/*
* Read a 32-bit value from the current position in a PCF font image.
*/
static int PCFReadInt32(PCFFontImage *image)
{
int byte1 = PCFReadInt8(image);
int byte2 = PCFReadInt8(image);
int byte3 = PCFReadInt8(image);
int byte4 = PCFReadInt8(image);
if((image->format & PCF_BYTEORDER_MSBFIRST) != 0)
{
return (int)((byte1 << 24) | (byte2 << 16) | (byte3 << 8) |
byte4);
}
else
{
return (int)((byte4 << 24) | (byte3 << 16) | (byte2 << 8) |
byte1);
}
}
/*
* Skip a number of bytes in a PCF font image.
*/
static void PCFSkipBytes(PCFFontImage *image, int num)
{
image->posn += (unsigned long)(long)num;
}
/*
* Select a particular table in a PCF font image. Returns zero if
* the table is not present. The stream will be positioned just after
* the 32-bit "format" value.
*/
static int PCFSelectTable(PCFFontImage *image, int table)
{
int count, index;
int type, format, size, offset;
image->posn = 4;
image->format = PCF_DEFAULT_FORMAT;
count = PCFReadInt32(image);
for(index = 0; index < count; ++index)
{
type = PCFReadInt32(image);
format = PCFReadInt32(image);
size = PCFReadInt32(image);
offset = PCFReadInt32(image);
if(type == table)
{
image->format = format;
image->posn = (unsigned long)(long)(offset + 4);
return 1;
}
}
return 0;
}
/*
* Read a full metrics value.
*/
static void PCFReadFullMetrics(PCFFontImage *image, XCharStruct *metrics)
{
metrics->lbearing = (short)(PCFReadInt16(image));
metrics->rbearing = (short)(PCFReadInt16(image));
metrics->width = (short)(PCFReadInt16(image));
metrics->ascent = (short)(PCFReadInt16(image));
metrics->descent = (short)(PCFReadInt16(image));
metrics->attributes = (unsigned short)(PCFReadInt16(image));
}
/*
* Read a compressed metrics value.
*/
static void PCFReadCompressedMetrics(PCFFontImage *image, XCharStruct *metrics)
{
metrics->lbearing = (short)(PCFReadInt8(image) - 128);
metrics->rbearing = (short)(PCFReadInt8(image) - 128);
metrics->width = (short)(PCFReadInt8(image) - 128);
metrics->ascent = (short)(PCFReadInt8(image) - 128);
metrics->descent = (short)(PCFReadInt8(image) - 128);
metrics->attributes = 0;
}
/*
* Free the memory used by a PCF font image.
*/
static void PCFFontFree(PCFFontImage *image)
{
if(image->fs.properties)
{
free(image->fs.properties);
}
if(image->fs.per_char)
{
free(image->fs.per_char);
}
if(image->glyphs)
{
free(image->glyphs);
}
free(image);
}
/*
* Create a PCF font image from the information in a font image buffer.
*/
void *XSharpPCFCreateImage(unsigned char *data, unsigned long length)
{
PCFFontImage *image;
int temp;
unsigned char *start;
/* Bail out if the data does not appear to be a PCF font image */
if(length < 4 || data[0] != 0x01 || data[1] != 'f' ||
data[2] != 'c' || data[3] != 'p')
{
return 0;
}
/* Allocate memory for the image */
image = (PCFFontImage *)calloc(1, sizeof(PCFFontImage));
if(!image)
{
return 0;
}
/* Initialize the image reading data */
image->data = data;
image->length = length;
image->posn = 0;
image->format = PCF_DEFAULT_FORMAT;
/* Select the "accelerators" table and then load it */
temp = PCFSelectTable(image, PCF_BDF_ACCELERATORS);
if(!temp)
{
temp = PCFSelectTable(image, PCF_ACCELERATORS);
}
if(temp)
{
PCFSkipBytes(image, 6);
image->fs.direction = (unsigned)(PCFReadInt8(image));
PCFSkipBytes(image, 1);
image->fs.ascent = PCFReadInt32(image);
image->fs.descent = PCFReadInt32(image);
PCFReadFullMetrics(image, &(image->fs.min_bounds));
PCFReadFullMetrics(image, &(image->fs.max_bounds));
}
/* Select the "BDF encodings" table and then load it */
if(PCFSelectTable(image, PCF_BDF_ENCODINGS))
{
image->fs.min_char_or_byte2 = (unsigned)(PCFReadInt16(image));
image->fs.max_char_or_byte2 = (unsigned)(PCFReadInt16(image));
image->fs.min_byte1 = (unsigned)(PCFReadInt16(image));
image->fs.max_byte1 = (unsigned)(PCFReadInt16(image));
image->fs.default_char = (unsigned)(PCFReadInt16(image) &
0xFFFF);
}
/* Select the "metrics" table and then load it */
if(PCFSelectTable(image, PCF_METRICS))
{
if((image->format & PCF_COMPRESSED_METRICS) == 0)
{
image->numGlyphs = PCFReadInt32(image);
image->fs.per_char = (XCharStruct *)malloc
(sizeof(XCharStruct) * image->numGlyphs);
if(!(image->fs.per_char))
{
PCFFontFree(image);
return 0;
}
for(temp = 0; temp < image->numGlyphs; ++image)
{
PCFReadFullMetrics(image,
&(image->fs.per_char[temp]));
}
}
else
{
image->numGlyphs = (PCFReadInt16(image) & 0xFFFF);
image->fs.per_char = (XCharStruct *)malloc
(sizeof(XCharStruct) * image->numGlyphs);
if(!(image->fs.per_char))
{
PCFFontFree(image);
return 0;
}
for(temp = 0; temp < image->numGlyphs; ++image)
{
PCFReadCompressedMetrics(image,
&(image->fs.per_char[temp]));
}
}
}
/* Collect up pointers to all of the glyph bitmaps */
if(PCFSelectTable(image, PCF_BITMAPS))
{
if(PCFReadInt32(image) != image->numGlyphs)
{
PCFFontFree(image);
return 0;
}
image->glyphFormat = image->format;
image->glyphs = (unsigned char **)malloc
(sizeof(unsigned char *) * image->numGlyphs);
if(!(image->glyphs))
{
PCFFontFree(image);
return 0;
}
start = image->data + image->posn + 16 +
(unsigned long)(long)(image->numGlyphs * 4);
for(temp = 0; temp < image->numGlyphs; ++temp)
{
image->glyphs[temp] = start + PCFReadInt32(image);
}
}
/* Sanity-check the values that we read to make sure that
we have sufficient information to do something useful */
temp = (int)((image->fs.max_char_or_byte2 -
image->fs.min_char_or_byte2 + 1) *
(image->fs.max_byte1 - image->fs.min_byte1 +
1));
if(!(image->numGlyphs) || image->numGlyphs != temp)
{
PCFFontFree(image);
return 0;
}
/* Return the PCF font image to the caller */
return image;
}
/*
* Destroy a PCF font image that is no longer required.
*/
void XSharpPCFDestroyImage(PCFFontImage *image)
{
if(image)
{
PCFFontFree(image);
}
}
/*
* Destroy a PCF font renderer that is no longer required.
*/
void XSharpPCFDestroy(Display *dpy, PCFFontRenderer *renderer)
{
if(renderer)
{
if(renderer->ximage)
{
if(renderer->ximage->data)
{
free(renderer->ximage->data);
renderer->ximage->data = 0;
}
XDestroyImage(renderer->ximage);
}
if(renderer->stippleGC)
{
XFreeGC(dpy, renderer->stippleGC);
}
if(renderer->stipple)
{
XFreePixmap(dpy, renderer->stipple);
}
}
}
/*
* Create a PCF font renderer for a particular display.
*/
void *XSharpPCFCreate(Display *dpy, PCFFontImage *image)
{
PCFFontRenderer *renderer;
int width, height;
/* Create the renderer structure */
renderer = (PCFFontRenderer *)calloc(1, sizeof(PCFFontRenderer));
if(!renderer)
{
return 0;
}
renderer->image = image;
/* Create an XImage that can be used to hold string bitmaps
prior to being sent to the X server */
width = image->fs.max_bounds.width * 33;
height = image->fs.ascent + image->fs.descent;
renderer->ximage = XCreateImage
(dpy, DefaultVisual(dpy, DefaultScreen(dpy)), 1,
XYBitmap,
0, 0, width, height, 8, 0);
if(!(renderer->ximage))
{
XSharpPCFRendererDestroy(dpy, renderer);
return 0;
}
renderer->ximage->data = (char *)calloc
(height * renderer->ximage->bytes_per_line, 1);
if(!(renderer->ximage->data))
{
XSharpPCFRendererDestroy(dpy, renderer);
return 0;
}
/* Create an X pixmap that acts as a stipple for string drawing */
renderer->stipple =
XCreatePixmap(dpy, RootWindow(dpy, DefaultScreen(dpy)),
width, height, 1);
renderer->stippleGC = XCreateGC(dpy, renderer->stipple, 0, 0);
/* Return the renderer to the caller */
return renderer;
}
/*
* Get the text extents for a string, using a PCF font renderer.
* Since the PCF font contains an XFontStruct, we can use the same
* algorithm as for XFontStruct-based fonts.
*/
void XSharpTextExtentsPCF(Display *dpy, void *fontSet, ILString *str,
long offset, long count,
XRectangle
*overall_ink_return,
XRectangle
*overall_logical_return)
{
PCFFontRenderer *renderer = (PCFFontRenderer *)fontSet;
XSharpTextExtentsStruct(dpy, &(renderer->image->fs),
str, offset, count,
overall_ink_return,
overall_logical_return);
}
/*
* Get the font extents for a PCF font renderer. Since the PCF font
* contains an XFontStruct, we can use the same algorithm as for
* XFontStruct-based fonts.
*/
void XSharpFontExtentsPCF(void *fontSet,
XRectangle *max_ink_return,
XRectangle *max_logical_return)
{
PCFFontRenderer *renderer = (PCFFontRenderer *)fontSet;
return XSharpFontExtentsStruct(&(renderer->image->fs),
max_ink_return, max_logical_return);
}
/*
* Draw a string using a client-side PCF font renderer.
*/
void XSharpDrawStringPCF(Display *dpy, Drawable drawable, GC gc,
void *fontSet, int x, int y, ILString
*str,
long offset, long length, int
style)
{
PCFFontRenderer *renderer = (PCFFontRenderer *)fontSet;
PCFFontImage *image = renderer->image;
XImage *ximage = renderer->ximage;
int posn;
int width, height, line;
XGCValues values;
ILChar *buffer = ILStringToBuffer(str) + offset;
XRectangle overall_ink;
XRectangle overall_logical;
int line1, line2;
long origOffset = offset;
long origLength = length;
int origX = x;
/* Save the current GC fill settings */
XGetGCValues(dpy, gc,
GCStipple | GCTileStipXOrigin |
GCTileStipYOrigin | GCFillStyle, &values);
/* Break the string up into 32-character sections and draw each section
*/
while(length > 0)
{
/* Get the dimensions of this section */
posn = 32;
if(posn > length)
{
posn = length;
}
XSharpTextExtentsStruct(dpy, &(image->fs), str, offset, posn,
&overall_ink,
&overall_logical);
width = overall_ink.width;
height = overall_logical.height;
/* Clear enough of the XImage to hold the section we'll be
rendering */
width = (width + ximage->bitmap_pad - 1) & ~(ximage->bitmap_pad
- 1);
line = height;
while(line > 0)
{
--line;
memset(ximage->data + line * ximage->bytes_per_line, 0,
width / 8);
}
/* Render the bitmaps for the characters into the XImage */
/* TODO */
/* Write the XImage into the stipple pixmap */
XPutImage(dpy, renderer->stipple, renderer->stippleGC, ximage,
0, 0, 0, 0, width, height);
/* Select the stipple and draw the text with it */
XSetStipple(dpy, gc, renderer->stipple);
XSetTSOrigin(dpy, gc, x + overall_ink.x, y + overall_logical.y);
XSetFillStyle(dpy, gc, FillStippled);
XFillRectangle(dpy, drawable, gc, x + overall_ink.x,
y + overall_logical.y, width,
height);
/* Advance to the next section */
offset += posn;
length -= posn;
x += overall_logical.width;
}
/* Restore the previous GC fill settings */
if(values.fill_style == FillStippled ||
values.fill_style == FillOpaqueStippled)
{
XChangeGC(dpy, gc,
GCStipple | GCTileStipXOrigin |
GCTileStipYOrigin | GCFillStyle, &values);
}
else
{
XChangeGC(dpy, gc, GCTileStipXOrigin | GCTileStipYOrigin |
GCFillStyle, &values);
}
/* Calculate the positions of the underline and strike-out */
if((style & FontStyle_Underline) != 0)
{
line1 = y + 1;
}
else
{
line1 = y;
}
if((style & FontStyle_StrikeOut) != 0)
{
line2 = y - (image->fs.ascent / 2);
}
else
{
line2 = y;
}
/* Draw the underline and strike-out */
if(line1 != y || line2 != y)
{
XSharpTextExtentsStruct(dpy, fontSet, str, origOffset,
origLength,
&overall_ink,
&overall_logical);
XSetLineAttributes(dpy, gc, 1, LineSolid, CapNotLast,
JoinMiter);
if(line1 != y)
{
XDrawLine(dpy, drawable, gc, origX, line1,
origX + overall_logical.width, line1);
}
if(line2 != y)
{
XDrawLine(dpy, drawable, gc, origX, line2,
origX + overall_logical.width, line2);
}
}
}
#else /* X_DISPLAY_MISSING || !HAVE_SELECT */
void *XSharpPCFCreateImage(unsigned char *data, unsigned long length)
{
/* Nothing to do here */
return 0;
}
void XSharpPCFDestroyImage(void *image)
{
/* Nothing to do here */
}
void XSharpPCFDestroy(void *dpy, void *renderer)
{
/* Nothing to do here */
}
void *XSharpPCFCreate(Display *dpy, void *image)
{
/* Nothing to do here */
}
void XSharpTextExtentsPCF(void *dpy, void *fontSet, void *str,
long offset, long count,
void *overall_ink_return,
void *overall_logical_return)
{
/* Nothing to do here */
}
#endif /* X_DISPLAY_MISSING || !HAVE_SELECT */
Index: XsharpSupport.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/Xsharp/XsharpSupport.c,v
retrieving revision 1.27
retrieving revision 1.28
diff -C2 -d -r1.27 -r1.28
*** XsharpSupport.c 30 Nov 2003 09:40:55 -0000 1.27
--- XsharpSupport.c 1 Dec 2003 02:48:42 -0000 1.28
***************
*** 21,55 ****
#if !defined(X_DISPLAY_MISSING) && HAVE_SELECT
! #include <X11/Xlib.h>
! #include <X11/Xutil.h>
! #include <X11/Xatom.h>
! #ifdef WIN32
! #include <X11/Xwinsock.h>
! #endif
! #ifdef USE_XFT_EXTENSION
! #include <X11/Xft/Xft.h>
! #endif
! #if TIME_WITH_SYS_TIME
! #include <sys/time.h>
! #include <time.h>
! #else
! #if HAVE_SYS_TIME_H
! #include <sys/time.h>
! #else
! #include <time.h>
! #endif
! #endif
! #if HAVE_SYS_TYPES_H
! #include <sys/types.h>
! #endif
! #if HAVE_SYS_SELECT_H
! #include <sys/select.h>
! #endif
! #if HAVE_UNISTD_H
! #include <unistd.h>
! #endif
! #include <stdlib.h>
! #include <stdio.h>
! #include <string.h>
int XSharpSupportPresent(void)
--- 21,25 ----
#if !defined(X_DISPLAY_MISSING) && HAVE_SELECT
! #include "XsharpSupport.h"
int XSharpSupportPresent(void)
***************
*** 93,136 ****
/*
- * Font style flags.
- */
- #define FontStyle_Normal 0
- #define FontStyle_Bold 1
- #define FontStyle_Italic 2
- #define FontStyle_Underline 4
- #define FontStyle_StrikeOut 8
- #define FontStyle_FontStruct 0x80
-
- /*
- * Structure of Portable.NET's "System.String" object for direct
- * access to the Unicode contents, bypassing PInvoke string conversion.
- *
- * Use the "ILStringLength" and "ILStringToBuffer" macros, so that
- * 32-bit vs 64-bit system differences are properly dealt with.
- */
- typedef unsigned short ILChar;
- typedef struct _tagILString ILString;
- typedef struct
- {
- int capacity;
- int length;
-
- } System_String_int;
- typedef struct
- {
- long capacity;
- long length;
-
- } System_String_long;
- #define ILStringLength(str) \
- (sizeof(int) == 4 \
- ? ((System_String_int *)(str))->length \
- : ((System_String_long *)(str))->length)
- #define ILStringToBuffer(str) \
- (sizeof(int) == 4 \
- ? (ILChar *)(((System_String_int *)(str)) + 1) \
- : (ILChar *)(((System_String_long *)(str)) + 1))
-
- /*
* Determine if we can use the Xft extension.
*/
--- 63,66 ----
***************
*** 406,410 ****
if((style & FontStyle_Underline) != 0)
{
! line1 = y + 2;
}
else
--- 336,340 ----
if((style & FontStyle_Underline) != 0)
{
! line1 = y + 1;
}
else
***************
*** 501,505 ****
if((style & FontStyle_Underline) != 0)
{
! line1 = y + 2;
}
else
--- 431,435 ----
if((style & FontStyle_Underline) != 0)
{
! line1 = y + 1;
}
else
***************
*** 580,584 ****
if((style & FontStyle_Underline) != 0)
{
! line1 = y + 2;
}
else
--- 510,514 ----
if((style & FontStyle_Underline) != 0)
{
! line1 = y + 1;
}
else
--- NEW FILE: XsharpSupport.h ---
/*
* XsharpSupport.h - C support code for Xsharp.
*
* Copyright (C) 2003 Southern Storm Software, Pty Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef _XSHARPSUPPORT_H
#define _XSHARPSUPPORT_H
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/Xatom.h>
#ifdef WIN32
#include <X11/Xwinsock.h>
#endif
#ifdef USE_XFT_EXTENSION
#include <X11/Xft/Xft.h>
#endif
#if TIME_WITH_SYS_TIME
#include <sys/time.h>
#include <time.h>
#else
#if HAVE_SYS_TIME_H
#include <sys/time.h>
#else
#include <time.h>
#endif
#endif
#if HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#if HAVE_SYS_SELECT_H
#include <sys/select.h>
#endif
#if HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
/*
* Font style flags.
*/
#define FontStyle_Normal 0
#define FontStyle_Bold 1
#define FontStyle_Italic 2
#define FontStyle_Underline 4
#define FontStyle_StrikeOut 8
#define FontStyle_FontStruct 0x80
/*
* Structure of Portable.NET's "System.String" object for direct
* access to the Unicode contents, bypassing PInvoke string conversion.
*
* Use the "ILStringLength" and "ILStringToBuffer" macros, so that
* 32-bit vs 64-bit system differences are properly dealt with.
*/
typedef unsigned short ILChar;
typedef struct _tagILString ILString;
typedef struct
{
int capacity;
int length;
} System_String_int;
typedef struct
{
long capacity;
long length;
} System_String_long;
#define ILStringLength(str) \
(sizeof(int) == 4 \
? ((System_String_int *)(str))->length \
: ((System_String_long *)(str))->length)
#define ILStringToBuffer(str) \
(sizeof(int) == 4 \
? (ILChar *)(((System_String_int *)(str)) + 1) \
: (ILChar *)(((System_String_long *)(str)) + 1))
/*
* Import common declarations.
*/
void XSharpTextExtentsStruct(Display *dpy, void *fontSet,
ILString *str, long offset,
long count,
XRectangle
*overall_ink_return,
XRectangle
*overall_logical_return);
void XSharpFontExtentsStruct(void *fontSet,
XRectangle *max_ink_return,
XRectangle
*max_logical_return);
#endif /* _XSHARPSUPPORT_H */
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Dotgnu-pnet-commits] pnetlib/Xsharp XsharpPCF.c, NONE, 1.1 XsharpSupport.h, NONE, 1.1 Makefile.am, 1.7, 1.8 XsharpSupport.c, 1.27, 1.28,
Rhys Weatherley <address@hidden> <=