Skip to content

Commit

Permalink
Merge branch 'master' into fmsound
Browse files Browse the repository at this point in the history
  • Loading branch information
rabe-soft committed Oct 1, 2024
2 parents d315a29 + c231771 commit 24e2da0
Show file tree
Hide file tree
Showing 14 changed files with 477 additions and 246 deletions.
76 changes: 38 additions & 38 deletions CInclude/file.h
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ typedef struct {
FileExtendedAttribute FEAD_attr; /* Attribute to get/set */
void *FEAD_value; /* Pointer to buffer/new value */
word FEAD_size; /* Size of buffer/new value */
char *FEAD_name; /* Null-terminated ASCII name of
TCHAR *FEAD_name; /* Null-terminated ASCII name of
* attribute if FEA_CUSTOM */
} FileExtAttrDesc;

Expand All @@ -164,7 +164,7 @@ typedef struct {
FileExtendedAttribute FEAD_attr; /* Attribute to get/set */
dword *FEAD_value; /* Pointer to buffer/new value */
word FEAD_size; /* Size of buffer/new value */
char *FEAD_name; /* Null-terminated ASCII name of
TCHAR *FEAD_name; /* Null-terminated ASCII name of
* attribute if FEA_CUSTOM */
} FileExtAttrDescLike;

Expand Down Expand Up @@ -248,17 +248,17 @@ typedef WordFlags FileOpenAndReadFlags;
/***/

extern word /* Returns error and sets value for ThreadGetError() */ /*XXX*/
_pascal FileCreateDir(const char *name);
_pascal FileCreateDir(const TCHAR *name);

/***/

extern word /* Returns error and sets value for ThreadGetError() */ /*XXX*/
_pascal FileCreateDirWithNativeShortName(const char *name);
_pascal FileCreateDirWithNativeShortName(const TCHAR *name);

/***/

extern word /* Returns error and sets value for ThreadGetError() */ /*XXX*/
_pascal FileDeleteDir(const char *name);
_pascal FileDeleteDir(const TCHAR *name);

/***/

Expand All @@ -273,7 +273,7 @@ extern void
/***/

extern DiskHandle /*XXX*/
_pascal FileGetCurrentPath(char *buffer, word bufferSize);
_pascal FileGetCurrentPath(TCHAR *buffer, word bufferSize);

/***/

Expand All @@ -299,15 +299,15 @@ extern void
/***/

extern DiskHandle /* Sets value for ThreadGetError() */ /*XXX*/
_pascal FileSetCurrentPath(DiskHandle disk, const char *path);
_pascal FileSetCurrentPath(DiskHandle disk, const TCHAR *path);

extern DiskHandle /* Sets value for ThreadGetError() */ /*XXX*/
_pascal FileSetCurrentPathRaw(DiskHandle disk, const char *path);
_pascal FileSetCurrentPathRaw(DiskHandle disk, const TCHAR *path);

/***/

extern FileHandle /* Sets value for ThreadGetError() */
_pascal FileOpen(const char *name, FileAccessFlags flags);
_pascal FileOpen(const TCHAR *name, FileAccessFlags flags);

/***/

Expand All @@ -324,7 +324,7 @@ typedef WordFlags FileCreateFlags;
#define FCF_ACCESS 0x00ff /* Filled with FileAccessFlags*/

extern FileHandle /* Sets value for ThreadGetError() */
_pascal FileCreate(const char *name, FileCreateFlags flags, FileAttrs attributes);
_pascal FileCreate(const TCHAR *name, FileCreateFlags flags, FileAttrs attributes);

/***/

Expand All @@ -341,7 +341,7 @@ extern word /* Returns error and sets value for ThreadGetError() */ /*XXX*/
/***/

extern FileHandle /* Sets value for ThreadGetError() */ /*XXX*/
_pascal FileCreateTempFile(const char *dir,
_pascal FileCreateTempFile(const TCHAR *dir,
FileCreateFlags flags,
FileAttrs attributes);
/***/
Expand All @@ -352,7 +352,7 @@ extern word /* Returns error and sets value for ThreadGetError() */
/***/

extern word /* Returns error and sets value for ThreadGetError() */ /*XXX*/
_pascal FileRename(const char *oldName, const char *newame);
_pascal FileRename(const TCHAR *oldName, const TCHAR *newame);

/***/

Expand Down Expand Up @@ -482,16 +482,16 @@ extern DiskHandle /* Sets value for ThreadGetError() */ /*XXX*/
/***/

extern FileAttrs /* Sets value for ThreadGetError() */ /*XXX*/
_pascal FileGetAttributes(const char *path);
_pascal FileGetAttributes(const TCHAR *path);

/***/

extern word /* Returns error and sets value for ThreadGetError() */ /*XXX*/
_pascal FileSetAttributes(const char *path, FileAttrs attr);
_pascal FileSetAttributes(const TCHAR *path, FileAttrs attr);

/***/
extern word /* Returns error and sets value for ThreadGetError() */ /*XXX*/
_pascal FileGetPathExtAttributes(const char *path, FileExtendedAttribute attr,
_pascal FileGetPathExtAttributes(const TCHAR *path, FileExtendedAttribute attr,
void *buffer, word bufSize);

extern word /* Returns error and sets value for ThreadGetError() */ /*XXX*/
Expand All @@ -502,7 +502,7 @@ extern MemHandle /* Sets value for ThreadGetError() */ /*XXX*/
_pascal FileGetHandleAllExtAttributes(FileHandle fh, word *numExtAttrs);

extern word /* Returns error and sets value for ThreadGetError() */ /*XXX*/
_pascal FileSetPathExtAttributes(const char *path, FileExtendedAttribute attr,
_pascal FileSetPathExtAttributes(const TCHAR *path, FileExtendedAttribute attr,
const void *buffer, word bufSize);

extern word /* Returns error and sets value for ThreadGetError() */ /*XXX*/
Expand Down Expand Up @@ -563,34 +563,34 @@ extern void
/***/

extern word /* Returns error and sets value for ThreadGetError() */
_pascal FileCopy(const char *source, const char *dest,
_pascal FileCopy(const TCHAR *source, const TCHAR *dest,
DiskHandle sourceDisk, DiskHandle destDisk);

extern word /* Returns error and sets value for ThreadGetError() */
_pascal FileCopyLocal(const char *source, const char *dest,
_pascal FileCopyLocal(const TCHAR *source, const TCHAR *dest,
DiskHandle sourceDisk, DiskHandle destDisk);

/***/

extern word /* Returns error and sets value for ThreadGetError() */
_pascal FileMove(const char *source, const char *dest,
_pascal FileMove(const TCHAR *source, const TCHAR *dest,
DiskHandle sourceDisk, DiskHandle destDisk);

extern word /* Returns error and sets value for ThreadGetError() */
_pascal FileMoveLocal(const char *source, const char *dest,
_pascal FileMoveLocal(const TCHAR *source, const TCHAR *dest,
DiskHandle sourceDisk, DiskHandle destDisk);

/***/

extern StandardPath /*XXX*/
_pascal FileParseStandardPath(DiskHandle disk, const char **path);
_pascal FileParseStandardPath(DiskHandle disk, const TCHAR **path);

/***/

extern DiskHandle /*XXX*/
_pascal FileConstructFullPath(char **buffer, word bufSize,
_pascal FileConstructFullPath(TCHAR **buffer, word bufSize,
DiskHandle disk,
const char *tail,
const TCHAR *tail,
Boolean addDriveLetter);

/***/
Expand All @@ -600,7 +600,7 @@ typedef WordFlags FileResolveStandardPathFlags;
#define FRSPF_RETURN_FIRST_DIR 0x0001

extern DiskHandle /*XXX*/
_pascal FileResolveStandardPath(char **buffer, word bufSize, const char *tail,
_pascal FileResolveStandardPath(TCHAR **buffer, word bufSize, const TCHAR *tail,
FileResolveStandardPathFlags flags,
FileAttrs *attrsPtr);
/***/
Expand All @@ -614,42 +614,42 @@ typedef ByteEnum PathCompareType;

extern PathCompareType
/*XXX*/
_pascal FileComparePaths(const char *path1,
_pascal FileComparePaths(const TCHAR *path1,
DiskHandle disk1,
const char *path2,
const TCHAR *path2,
DiskHandle disk2);

extern word
_pascal FileCreateLink(const char *path,
_pascal FileCreateLink(const TCHAR *path,
word targetDiskHandle,
const char *targetPath,
const TCHAR *targetPath,
word targetAttrsFlag);
extern DiskHandle
_pascal FileReadLink(const char *path, const char *targetPath);
_pascal FileReadLink(const TCHAR *path, const TCHAR *targetPath);

extern DiskHandle
_pascal FileSetLinkExtraData(const char *path,
char *buffer,
_pascal FileSetLinkExtraData(const TCHAR *path,
TCHAR *buffer,
word bufSize);
extern DiskHandle
_pascal FileGetLinkExtraData(const char *path,
char *buffer,
_pascal FileGetLinkExtraData(const TCHAR *path,
TCHAR *buffer,
word bufSize);
extern DiskHandle
_pascal FileConstructActualPath(char **buffer,
_pascal FileConstructActualPath(TCHAR **buffer,
word bufSize, DiskHandle disk,
const char _far *tail,
const TCHAR _far *tail,
Boolean addDriveLetter);
extern word
/*XXX*/
_pascal FileCopyPathExtAttributes(const char *sourcePath,
_pascal FileCopyPathExtAttributes(const TCHAR *sourcePath,
DiskHandle sourceDisk,
const char *destPath,
const TCHAR *destPath,
DiskHandle destDisk);

extern MemHandle /*XXX*/
_pascal FileOpenAndRead(FileOpenAndReadFlags flags,
const char _far *filename,
const TCHAR _far *filename,
FileHandle *fh);


Expand Down
1 change: 1 addition & 0 deletions Driver/Font/TrueType/Adapter/ttadapter.h
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,7 @@ typedef struct

typedef struct
{
Boolean FH_initialized;
word FH_h_height; //top of 'H'
word FH_x_height; //top of 'x'
word FH_ascender; //top of 'd'
Expand Down
18 changes: 10 additions & 8 deletions Driver/Font/TrueType/Adapter/ttinit.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ static word getNameFromNameTable(
char* name,
TT_UShort nameIndex );

static void ConvertHeader( TRUETYPE_VARS, FontHeader* fontHeader );
void InitConvertHeader( TRUETYPE_VARS, FontHeader* fontHeader );

static char GetDefaultChar( TRUETYPE_VARS, char firstChar );

Expand Down Expand Up @@ -379,7 +379,7 @@ EC( ECCheckFileHandle( truetypeFile ) );

/* fill FontHeader */
fontHeader = LMemDerefHandles( fontInfoBlock, fontHeaderChunk );
ConvertHeader( trueTypeVars, fontHeader );
memset(fontHeader, 0, sizeof(FontHeader));

fontInfo->FI_outlineTab = sizeof( FontInfo );
fontInfo->FI_outlineEnd = sizeof( FontInfo ) + sizeof( OutlineDataEntry );
Expand Down Expand Up @@ -440,7 +440,7 @@ EC( ECCheckFileHandle( truetypeFile ) );

/* fill FontHeader */
fontHeader = LMemDerefHandles( fontInfoBlock, fontHeaderChunk );
ConvertHeader( trueTypeVars, fontHeader );
memset(fontHeader, 0, sizeof(FontHeader));

fontInfo = LMemDeref( ConstructOptr(fontInfoBlock, fontInfoChunk) );
fontInfo->FI_outlineEnd += sizeof( OutlineDataEntry );
Expand Down Expand Up @@ -819,7 +819,7 @@ static word getNameFromNameTable( TRUETYPE_VARS, char* name, TT_UShort nameID )


/********************************************************************
* ConvertHeader
* InitConvertHeader
********************************************************************
* SYNOPSIS: Converts information from a TrueType font into a
* FreeGEOS FontHeader.
Expand All @@ -840,14 +840,16 @@ static word getNameFromNameTable( TRUETYPE_VARS, char* name, TT_UShort nameID )
* 21/01/23 JK Initial Revision
*******************************************************************/

static void ConvertHeader( TRUETYPE_VARS, FontHeader* fontHeader )
void InitConvertHeader( TRUETYPE_VARS, FontHeader* fontHeader )
{
TT_UShort charIndex;
word geosChar;


EC( ECCheckBounds( (void*)fontHeader ) );


if(fontHeader->FH_initialized) return;

/* initialize min, max and avg values in fontHeader */
fontHeader->FH_minLSB = 9999;
fontHeader->FH_maxBSB = -9999;
Expand All @@ -863,7 +865,6 @@ EC( ECCheckBounds( (void*)fontHeader ) );
fontHeader->FH_defaultChar = GetDefaultChar( trueTypeVars, fontHeader->FH_firstChar );
fontHeader->FH_kernCount = GetKernCount( trueTypeVars );

TT_New_Instance( FACE, &INSTANCE );
TT_New_Glyph( FACE, &GLYPH );

for ( geosChar = fontHeader->FH_firstChar; geosChar < fontHeader->FH_lastChar; ++geosChar )
Expand Down Expand Up @@ -931,7 +932,6 @@ EC( ECCheckBounds( (void*)fontHeader ) );
}

TT_Done_Glyph( GLYPH );
TT_Done_Instance( INSTANCE );

fontHeader->FH_avgwidth = FACE_PROPERTIES.os2->xAvgCharWidth;
fontHeader->FH_maxwidth = FACE_PROPERTIES.horizontal->advance_Width_Max;
Expand All @@ -947,6 +947,8 @@ EC( ECCheckBounds( (void*)fontHeader ) );
fontHeader->FH_strikePos = 3 * fontHeader->FH_x_height / 5;
else
fontHeader->FH_strikePos = 3 * fontHeader->FH_ascent / 5;

fontHeader->FH_initialized = TRUE;
}


Expand Down
6 changes: 6 additions & 0 deletions Driver/Font/TrueType/Adapter/ttpath.c
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,8 @@ static void CalcDriversTransformMatrix( TransformMatrix* transformMatrix,
GStateHandle gstate,
WindowHandle win );

extern void InitConvertHeader( TRUETYPE_VARS, FontHeader* fontHeader );


/********************************************************************
* TrueType_Gen_Path
Expand Down Expand Up @@ -166,6 +168,8 @@ EC( ECCheckBounds( (void*)fontHeader ) );
if( TrueType_Lock_Face(trueTypeVars, trueTypeOutline) )
goto Fin;

InitConvertHeader(trueTypeVars, fontHeader);

TT_New_Glyph( FACE, &GLYPH );

/* get TT char index */
Expand Down Expand Up @@ -313,6 +317,8 @@ EC( ECCheckBounds( (void*)fontHeader ) );
if( TrueType_Lock_Face(trueTypeVars, trueTypeOutline) )
goto Fin;

InitConvertHeader(trueTypeVars, fontHeader);

/* get TT char index */
charIndex = TT_Char_Index( CHAR_MAP, GeosCharToUnicode( character ) );
if( charIndex == 0 )
Expand Down
6 changes: 5 additions & 1 deletion Driver/Font/TrueType/Adapter/ttwidths.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ static void AdjustFontBuf( TransformMatrix* transMatrix,
static Boolean IsRegionNeeded( TransformMatrix* transMatrix,
FontBuf* fontBuf );

extern void InitConvertHeader( TRUETYPE_VARS, FontHeader* fontHeader );


#define ROUND_WWFIXED( value ) ( value & 0xffff ? ( value >> 16 ) + 1 : value >> 16 )

Expand Down Expand Up @@ -157,6 +159,8 @@ EC( ECCheckBounds( (void*)fontHeader ) );
if( TrueType_Lock_Face(trueTypeVars, trueTypeOutline) )
goto Fail;

InitConvertHeader( trueTypeVars, fontHeader );

/* alloc Block for FontBuf, CharTableEntries, KernPairs and kerning values */
size = AllocFontBlock( sizeof( TransformMatrix ),
fontHeader->FH_numChars,
Expand Down Expand Up @@ -569,7 +573,7 @@ static word AllocFontBlock( word additionalSpace,
if( *fontHandle == NullHandle )
{
*fontHandle = MemAllocSetOwner( FONT_MAN_ID, MAX_FONTBUF_SIZE,
HF_SWAPABLE | HF_SHARABLE | HF_DISCARDABLE,
HF_SWAPABLE | HF_SHARABLE,
HAF_NO_ERR | HAF_LOCK | HAF_ZERO_INIT );
EC( ECCheckMemHandle( *fontHandle ) );
HandleP( *fontHandle );
Expand Down
Loading

0 comments on commit 24e2da0

Please sign in to comment.