gdiplus: Implement GdipGet/SetStringFormatMeasurableCharacterRanges.
This commit is contained in:
parent
e2f7946bbc
commit
9f63f7d949
|
@ -282,6 +282,8 @@ struct GpStringFormat{
|
|||
INT tabcount;
|
||||
REAL firsttab;
|
||||
REAL *tabs;
|
||||
CharacterRange *character_ranges;
|
||||
INT range_count;
|
||||
};
|
||||
|
||||
struct GpFontCollection{
|
||||
|
|
|
@ -48,6 +48,8 @@ GpStatus WINGDIPAPI GdipCreateStringFormat(INT attr, LANGID lang,
|
|||
(*format)->digitlang = LANG_NEUTRAL;
|
||||
(*format)->trimming = StringTrimmingCharacter;
|
||||
(*format)->digitsub = StringDigitSubstituteUser;
|
||||
(*format)->character_ranges = NULL;
|
||||
(*format)->range_count = 0;
|
||||
/* tabstops */
|
||||
(*format)->tabcount = 0;
|
||||
(*format)->firsttab = 0.0;
|
||||
|
@ -61,6 +63,7 @@ GpStatus WINGDIPAPI GdipDeleteStringFormat(GpStringFormat *format)
|
|||
if(!format)
|
||||
return InvalidParameter;
|
||||
|
||||
GdipFree(format->character_ranges);
|
||||
GdipFree(format->tabs);
|
||||
GdipFree(format);
|
||||
|
||||
|
@ -146,9 +149,11 @@ GpStatus WINGDIPAPI GdipGetStringFormatMeasurableCharacterRangeCount(
|
|||
if (!(format && count))
|
||||
return InvalidParameter;
|
||||
|
||||
FIXME("stub: %p %p\n", format, count);
|
||||
TRACE("%p %p\n", format, count);
|
||||
|
||||
return NotImplemented;
|
||||
*count = format->range_count;
|
||||
|
||||
return Ok;
|
||||
}
|
||||
|
||||
GpStatus WINGDIPAPI GdipGetStringFormatTabStopCount(GDIPCONST GpStringFormat *format,
|
||||
|
@ -242,15 +247,22 @@ GpStatus WINGDIPAPI GdipSetStringFormatLineAlign(GpStringFormat *format,
|
|||
return Ok;
|
||||
}
|
||||
|
||||
GpStatus WINGDIPAPI GdipSetStringFormatMeasurableCharacterRanges(GpStringFormat*
|
||||
format, INT rangeCount, GDIPCONST CharacterRange* ranges)
|
||||
GpStatus WINGDIPAPI GdipSetStringFormatMeasurableCharacterRanges(
|
||||
GpStringFormat *format, INT rangeCount, GDIPCONST CharacterRange *ranges)
|
||||
{
|
||||
if (!(format && rangeCount && ranges))
|
||||
if (!(format && ranges))
|
||||
return InvalidParameter;
|
||||
|
||||
FIXME("stub: %p, %d, %p\n", format, rangeCount, ranges);
|
||||
TRACE("%p, %d, %p\n", format, rangeCount, ranges);
|
||||
|
||||
return NotImplemented;
|
||||
format->character_ranges = GdipAlloc(rangeCount * sizeof(CharacterRange));
|
||||
if (!format->character_ranges)
|
||||
return OutOfMemory;
|
||||
|
||||
memcpy(format->character_ranges, ranges, sizeof(CharacterRange) * rangeCount);
|
||||
format->range_count = rangeCount;
|
||||
|
||||
return Ok;
|
||||
}
|
||||
|
||||
GpStatus WINGDIPAPI GdipSetStringFormatTabStops(GpStringFormat *format, REAL firsttab,
|
||||
|
@ -331,6 +343,19 @@ GpStatus WINGDIPAPI GdipCloneStringFormat(GDIPCONST GpStringFormat *format, GpSt
|
|||
else
|
||||
(*newFormat)->tabs = NULL;
|
||||
|
||||
if(format->range_count > 0){
|
||||
(*newFormat)->character_ranges = GdipAlloc(sizeof(CharacterRange) * format->range_count);
|
||||
if(!(*newFormat)->character_ranges){
|
||||
GdipFree((*newFormat)->tabs);
|
||||
GdipFree(*newFormat);
|
||||
return OutOfMemory;
|
||||
}
|
||||
memcpy((*newFormat)->character_ranges, format->character_ranges,
|
||||
sizeof(CharacterRange) * format->range_count);
|
||||
}
|
||||
else
|
||||
(*newFormat)->character_ranges = NULL;
|
||||
|
||||
TRACE("%p %p\n",format,newFormat);
|
||||
|
||||
return Ok;
|
||||
|
|
|
@ -29,7 +29,7 @@ static void test_constructor(void)
|
|||
{
|
||||
GpStringFormat *format;
|
||||
GpStatus stat;
|
||||
INT n;
|
||||
INT n, count;
|
||||
StringAlignment align, valign;
|
||||
StringTrimming trimming;
|
||||
StringDigitSubstitute digitsub;
|
||||
|
@ -43,6 +43,7 @@ static void test_constructor(void)
|
|||
GdipGetStringFormatHotkeyPrefix(format, &n);
|
||||
GdipGetStringFormatTrimming(format, &trimming);
|
||||
GdipGetStringFormatDigitSubstitution(format, &digitlang, &digitsub);
|
||||
GdipGetStringFormatMeasurableCharacterRangeCount(format, &count);
|
||||
|
||||
expect(HotkeyPrefixNone, n);
|
||||
expect(StringAlignmentNear, align);
|
||||
|
@ -50,6 +51,7 @@ static void test_constructor(void)
|
|||
expect(StringTrimmingCharacter, trimming);
|
||||
expect(StringDigitSubstituteUser, digitsub);
|
||||
expect(LANG_NEUTRAL, digitlang);
|
||||
expect(0, count);
|
||||
|
||||
stat = GdipDeleteStringFormat(format);
|
||||
expect(Ok, stat);
|
||||
|
@ -64,14 +66,19 @@ static void test_characterrange(void)
|
|||
|
||||
stat = GdipCreateStringFormat(0, LANG_NEUTRAL, &format);
|
||||
expect(Ok, stat);
|
||||
todo_wine
|
||||
{
|
||||
stat = GdipSetStringFormatMeasurableCharacterRanges(NULL, 3, ranges);
|
||||
expect(InvalidParameter, stat);
|
||||
stat = GdipSetStringFormatMeasurableCharacterRanges(format, 0, ranges);
|
||||
expect(Ok, stat);
|
||||
stat = GdipSetStringFormatMeasurableCharacterRanges(format, 3, NULL);
|
||||
expect(InvalidParameter, stat);
|
||||
|
||||
stat = GdipSetStringFormatMeasurableCharacterRanges(format, 3, ranges);
|
||||
expect(Ok, stat);
|
||||
stat = GdipGetStringFormatMeasurableCharacterRangeCount(format, &count);
|
||||
expect(Ok, stat);
|
||||
if (stat == Ok) expect(3, count);
|
||||
}
|
||||
|
||||
stat= GdipDeleteStringFormat(format);
|
||||
expect(Ok, stat);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue