📄 gdiplus_string.cpp
字号:
#include "stdafx.h"
#include "GdiplusShunt.h"
//----------------------------------------------------------------------------
// Text APIs
//----------------------------------------------------------------------------
DEFINE_POINTER(GpStatus (WINGDIPAPI *GdipDrawStringPtr)(
GpGraphics *graphics, GDIPCONST WCHAR *string,
INT length, GDIPCONST GpFont *font,
GDIPCONST RectF *layoutRect,
GDIPCONST GpStringFormat *stringFormat, GDIPCONST GpBrush *brush));
DEFINE_MEMBER(GdipDrawString);
GpStatus WINGDIPAPI
GdipDrawString(
GpGraphics *graphics, GDIPCONST WCHAR *string,
INT length, GDIPCONST GpFont *font,
GDIPCONST RectF *layoutRect,
GDIPCONST GpStringFormat *stringFormat, GDIPCONST GpBrush *brush
)
{
GpStatus status = GdiplusNotInitialized;
if ( g_hGdiplusModule != 0 )
{
if ( g_GdipDrawString == NULL )
{
INITIALIZE_MEMBER(g_hGdiplusModule, GdipDrawString);
}
if ( g_GdipDrawString != NULL )
{
status = (*g_GdipDrawString)(graphics, string, length, font, layoutRect, stringFormat, brush);
}
}
return status;
}
DEFINE_POINTER(GpStatus (WINGDIPAPI *GdipMeasureStringPtr)(
GpGraphics *graphics,
GDIPCONST WCHAR *string, INT length,
GDIPCONST GpFont *font, GDIPCONST RectF *layoutRect,
GDIPCONST GpStringFormat *stringFormat, RectF *boundingBox,
INT *codepointsFitted, INT *linesFilled));
DEFINE_MEMBER(GdipMeasureString);
GpStatus WINGDIPAPI
GdipMeasureString(
GpGraphics *graphics,
GDIPCONST WCHAR *string, INT length,
GDIPCONST GpFont *font, GDIPCONST RectF *layoutRect,
GDIPCONST GpStringFormat *stringFormat, RectF *boundingBox,
INT *codepointsFitted, INT *linesFilled
)
{
GpStatus status = GdiplusNotInitialized;
if ( g_hGdiplusModule != 0 )
{
if ( g_GdipMeasureString == NULL )
{
INITIALIZE_MEMBER(g_hGdiplusModule, GdipMeasureString);
}
if ( g_GdipMeasureString != NULL )
{
status = (*g_GdipMeasureString)(graphics, string, length, font, layoutRect, stringFormat, boundingBox, codepointsFitted, linesFilled);
}
}
return status;
}
/* This function is using reference */
DEFINE_POINTER(GpStatus (WINGDIPAPI *GdipMeasureCharacterRangesPtr)(
GpGraphics *graphics, GDIPCONST WCHAR *string,
INT length, GDIPCONST GpFont *font,
GDIPCONST RectF &layoutRect, GDIPCONST GpStringFormat *stringFormat,
INT regionCount, GpRegion **regions));
DEFINE_MEMBER(GdipMeasureCharacterRanges);
GpStatus WINGDIPAPI
GdipMeasureCharacterRanges(
GpGraphics *graphics, GDIPCONST WCHAR *string,
INT length, GDIPCONST GpFont *font,
GDIPCONST RectF &layoutRect, GDIPCONST GpStringFormat *stringFormat,
INT regionCount, GpRegion **regions)
{
GpStatus status = GdiplusNotInitialized;
if ( g_hGdiplusModule != NULL )
{
if ( g_GdipMeasureCharacterRanges == NULL )
{
INITIALIZE_MEMBER(g_hGdiplusModule, GdipMeasureCharacterRanges);
}
if ( g_GdipMeasureCharacterRanges != NULL )
{
status = (*g_GdipMeasureCharacterRanges)(graphics, string,length, font, layoutRect, stringFormat, regionCount, regions);
}
}
return status;
}
DEFINE_POINTER(GpStatus (WINGDIPAPI *GdipDrawDriverStringPtr)(
GpGraphics *graphics, GDIPCONST UINT16 *text,
INT length, GDIPCONST GpFont *font,
GDIPCONST GpBrush *brush, GDIPCONST PointF *positions,
INT flags, GDIPCONST GpMatrix *matrix));
DEFINE_MEMBER(GdipDrawDriverString);
GpStatus WINGDIPAPI
GdipDrawDriverString(
GpGraphics *graphics, GDIPCONST UINT16 *text,
INT length, GDIPCONST GpFont *font,
GDIPCONST GpBrush *brush, GDIPCONST PointF *positions,
INT flags, GDIPCONST GpMatrix *matrix
)
{
GpStatus status = GdiplusNotInitialized;
if ( g_hGdiplusModule != NULL )
{
if ( g_GdipDrawDriverString == NULL )
{
INITIALIZE_MEMBER(g_hGdiplusModule, GdipDrawDriverString);
}
if ( g_GdipDrawDriverString != NULL )
{
status = (*g_GdipDrawDriverString)(graphics, text, length, font, brush, positions, flags, matrix);
}
}
return status;
}
DEFINE_POINTER(GpStatus (WINGDIPAPI *GdipMeasureDriverStringPtr)(
GpGraphics *graphics, GDIPCONST UINT16 *text, INT length,
GDIPCONST GpFont *font, GDIPCONST PointF *positions, INT flags,
GDIPCONST GpMatrix *matrix, RectF *boundingBox));
DEFINE_MEMBER(GdipMeasureDriverString);
GpStatus WINGDIPAPI
GdipMeasureDriverString(
GpGraphics *graphics,
GDIPCONST UINT16 *text,
INT length,
GDIPCONST GpFont *font,
GDIPCONST PointF *positions,
INT flags,
GDIPCONST GpMatrix *matrix,
RectF *boundingBox
)
{
GpStatus status = GdiplusNotInitialized;
if ( g_hGdiplusModule != NULL )
{
if ( g_GdipMeasureDriverString == NULL )
{
INITIALIZE_MEMBER(g_hGdiplusModule, GdipMeasureDriverString);
}
if ( g_GdipMeasureDriverString != NULL )
{
status = (*g_GdipMeasureDriverString)(graphics, text, length, font, positions, flags, matrix, boundingBox);
}
}
return status;
}
//----------------------------------------------------------------------------
// String format APIs
//----------------------------------------------------------------------------
DEFINE_POINTER(GpStatus (WINGDIPAPI *GdipCreateStringFormatPtr)(
INT formatAttributes, LANGID language, GpStringFormat **format));
DEFINE_MEMBER(GdipCreateStringFormat);
GpStatus WINGDIPAPI
GdipCreateStringFormat(
INT formatAttributes, LANGID language, GpStringFormat **format)
{
GpStatus status = GdiplusNotInitialized;
if ( g_hGdiplusModule != NULL )
{
if ( g_GdipCreateStringFormat == NULL )
{
INITIALIZE_MEMBER(g_hGdiplusModule, GdipCreateStringFormat);
}
if ( g_GdipCreateStringFormat != NULL )
{
status = (*g_GdipCreateStringFormat)(formatAttributes, language, format);
}
}
return status;
}
DEFINE_POINTER(GpStatus (WINGDIPAPI *GdipStringFormatGetGenericDefaultPtr)(GpStringFormat **format));
DEFINE_MEMBER(GdipStringFormatGetGenericDefault);
GpStatus WINGDIPAPI
GdipStringFormatGetGenericDefault(GpStringFormat **format)
{
GpStatus status = GdiplusNotInitialized;
if ( g_hGdiplusModule != NULL )
{
if ( g_GdipStringFormatGetGenericDefault == NULL )
{
INITIALIZE_MEMBER(g_hGdiplusModule, GdipStringFormatGetGenericDefault);
}
if ( g_GdipStringFormatGetGenericDefault != NULL )
{
status = (*g_GdipStringFormatGetGenericDefault)(format);
}
}
return status;
}
DEFINE_POINTER(GpStatus (WINGDIPAPI *GdipStringFormatGetGenericTypographicPtr)(GpStringFormat **format));
DEFINE_MEMBER(GdipStringFormatGetGenericTypographic);
GpStatus WINGDIPAPI
GdipStringFormatGetGenericTypographic(GpStringFormat **format)
{
GpStatus status = GdiplusNotInitialized;
if ( g_hGdiplusModule != NULL )
{
if ( g_GdipStringFormatGetGenericTypographic == NULL )
{
INITIALIZE_MEMBER(g_hGdiplusModule, GdipStringFormatGetGenericTypographic);
}
if ( g_GdipStringFormatGetGenericTypographic != NULL )
{
status = (*g_GdipStringFormatGetGenericTypographic)(format);
}
}
return status;
}
DEFINE_POINTER(GpStatus (WINGDIPAPI *GdipDeleteStringFormatPtr)(GpStringFormat *format));
DEFINE_MEMBER(GdipDeleteStringFormat);
GpStatus WINGDIPAPI
GdipDeleteStringFormat(GpStringFormat *format)
{
GpStatus status = GdiplusNotInitialized;
if ( g_hGdiplusModule != NULL )
{
if ( g_GdipDeleteStringFormat == NULL )
{
INITIALIZE_MEMBER(g_hGdiplusModule, GdipDeleteStringFormat);
}
if ( g_GdipDeleteStringFormat != NULL )
{
status = (*g_GdipDeleteStringFormat)(format);
}
}
return status;
}
DEFINE_POINTER(GpStatus (WINGDIPAPI *GdipCloneStringFormatPtr)(GDIPCONST GpStringFormat *format,
GpStringFormat **newFormat));
DEFINE_MEMBER(GdipCloneStringFormat);
GpStatus WINGDIPAPI
GdipCloneStringFormat(GDIPCONST GpStringFormat *format,
GpStringFormat **newFormat)
{
GpStatus status = GdiplusNotInitialized;
if ( g_hGdiplusModule != NULL )
{
if ( g_GdipCloneStringFormat == NULL )
{
INITIALIZE_MEMBER(g_hGdiplusModule, GdipCloneStringFormat);
}
if ( g_GdipCloneStringFormat != NULL )
{
status = (*g_GdipCloneStringFormat)(format, newFormat);
}
}
return status;
}
DEFINE_POINTER(GpStatus (WINGDIPAPI *GdipSetStringFormatFlagsPtr)(GpStringFormat *format, INT flags));
DEFINE_MEMBER(GdipSetStringFormatFlags);
GpStatus WINGDIPAPI
GdipSetStringFormatFlags(GpStringFormat *format, INT flags)
{
GpStatus status = GdiplusNotInitialized;
if ( g_hGdiplusModule != NULL )
{
if ( g_GdipSetStringFormatFlags == NULL )
{
INITIALIZE_MEMBER(g_hGdiplusModule, GdipSetStringFormatFlags);
}
if ( g_GdipSetStringFormatFlags != NULL )
{
status = (*g_GdipSetStringFormatFlags)(format, flags);
}
}
return status;
}
DEFINE_POINTER(GpStatus (WINGDIPAPI *GdipGetStringFormatFlagsPtr)(GDIPCONST GpStringFormat *format,
INT *flags));
DEFINE_MEMBER(GdipGetStringFormatFlags);
GpStatus WINGDIPAPI GdipGetStringFormatFlags(GDIPCONST GpStringFormat *format, INT *flags)
{
GpStatus status = GdiplusNotInitialized;
if ( g_hGdiplusModule != NULL )
{
if ( g_GdipGetStringFormatFlags == NULL )
{
INITIALIZE_MEMBER(g_hGdiplusModule, GdipGetStringFormatFlags);
}
if ( g_GdipGetStringFormatFlags != NULL )
{
status = (*g_GdipGetStringFormatFlags)(format, flags);
}
}
return status;
}
DEFINE_POINTER(GpStatus (WINGDIPAPI *GdipSetStringFormatAlignPtr)(GpStringFormat *format, StringAlignment align));
DEFINE_MEMBER(GdipSetStringFormatAlign);
GpStatus WINGDIPAPI
GdipSetStringFormatAlign(GpStringFormat *format, StringAlignment align)
{
GpStatus status = GdiplusNotInitialized;
if ( g_hGdiplusModule != NULL )
{
if ( g_GdipSetStringFormatAlign == NULL )
{
INITIALIZE_MEMBER(g_hGdiplusModule, GdipSetStringFormatAlign);
}
if ( g_GdipSetStringFormatAlign != NULL )
{
status = (*g_GdipSetStringFormatAlign)(format, align);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -