riched20: Add a helper to add a font to the font table.
Signed-off-by: Huw Davies <huw@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
1e1ee175f0
commit
6ee979c7e6
|
@ -213,6 +213,29 @@ ME_StreamOutRTFHeader(ME_OutStream *pStream, int dwFormat)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void add_font_to_fonttbl( ME_OutStream *stream, ME_Style *style )
|
||||||
|
{
|
||||||
|
ME_FontTableItem *table = stream->fonttbl;
|
||||||
|
CHARFORMAT2W *fmt = &style->fmt;
|
||||||
|
WCHAR *face = fmt->szFaceName;
|
||||||
|
BYTE charset = (fmt->dwMask & CFM_CHARSET) ? fmt->bCharSet : DEFAULT_CHARSET;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
if (fmt->dwMask & CFM_FACE)
|
||||||
|
{
|
||||||
|
for (i = 0; i < stream->nFontTblLen; i++)
|
||||||
|
if (table[i].bCharSet == charset
|
||||||
|
&& (table[i].szFaceName == face || !lstrcmpW(table[i].szFaceName, face)))
|
||||||
|
break;
|
||||||
|
|
||||||
|
if (i == stream->nFontTblLen && i < STREAMOUT_FONTTBL_SIZE)
|
||||||
|
{
|
||||||
|
table[i].bCharSet = charset;
|
||||||
|
table[i].szFaceName = face;
|
||||||
|
stream->nFontTblLen++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static BOOL
|
static BOOL
|
||||||
ME_StreamOutRTFFontAndColorTbl(ME_OutStream *pStream, ME_DisplayItem *pFirstRun,
|
ME_StreamOutRTFFontAndColorTbl(ME_OutStream *pStream, ME_DisplayItem *pFirstRun,
|
||||||
|
@ -228,20 +251,7 @@ ME_StreamOutRTFFontAndColorTbl(ME_OutStream *pStream, ME_DisplayItem *pFirstRun,
|
||||||
CHARFORMAT2W *fmt = &item->member.run.style->fmt;
|
CHARFORMAT2W *fmt = &item->member.run.style->fmt;
|
||||||
COLORREF crColor;
|
COLORREF crColor;
|
||||||
|
|
||||||
if (fmt->dwMask & CFM_FACE) {
|
add_font_to_fonttbl( pStream, item->member.run.style );
|
||||||
WCHAR *face = fmt->szFaceName;
|
|
||||||
BYTE bCharSet = (fmt->dwMask & CFM_CHARSET) ? fmt->bCharSet : DEFAULT_CHARSET;
|
|
||||||
|
|
||||||
for (i = 0; i < pStream->nFontTblLen; i++)
|
|
||||||
if (table[i].bCharSet == bCharSet
|
|
||||||
&& (table[i].szFaceName == face || !lstrcmpW(table[i].szFaceName, face)))
|
|
||||||
break;
|
|
||||||
if (i == pStream->nFontTblLen && i < STREAMOUT_FONTTBL_SIZE) {
|
|
||||||
table[i].bCharSet = bCharSet;
|
|
||||||
table[i].szFaceName = face;
|
|
||||||
pStream->nFontTblLen++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (fmt->dwMask & CFM_COLOR && !(fmt->dwEffects & CFE_AUTOCOLOR)) {
|
if (fmt->dwMask & CFM_COLOR && !(fmt->dwEffects & CFE_AUTOCOLOR)) {
|
||||||
crColor = fmt->crTextColor;
|
crColor = fmt->crTextColor;
|
||||||
|
|
Loading…
Reference in New Issue