diff --git a/libfreerdp-cache/glyph.c b/libfreerdp-cache/glyph.c index 014b74640..bd66fc8c5 100644 --- a/libfreerdp-cache/glyph.c +++ b/libfreerdp-cache/glyph.c @@ -323,7 +323,27 @@ void update_gdi_cache_glyph(rdpContext* context, CACHE_GLYPH_ORDER* cache_glyph) void update_gdi_cache_glyph_v2(rdpContext* context, CACHE_GLYPH_V2_ORDER* cache_glyph_v2) { + int i; + rdpGlyph* glyph; + GLYPH_DATA_V2* glyph_data; + rdpCache* cache = context->cache; + for (i = 0; i < (int) cache_glyph_v2->cGlyphs; i++) + { + glyph_data = cache_glyph_v2->glyphData[i]; + + glyph = Glyph_Alloc(context); + + glyph->x = glyph_data->x; + glyph->y = glyph_data->y; + glyph->cx = glyph_data->cx; + glyph->cy = glyph_data->cy; + glyph->aj = glyph_data->aj; + glyph->cb = glyph_data->cb; + Glyph_New(context, glyph); + + glyph_cache_put(cache->glyph, cache_glyph_v2->cacheId, glyph_data->cacheIndex, glyph); + } } rdpGlyph* glyph_cache_get(rdpGlyphCache* glyph_cache, uint32 id, uint32 index) diff --git a/libfreerdp-core/capabilities.c b/libfreerdp-core/capabilities.c index d537bad9b..0fbcbeb54 100644 --- a/libfreerdp-core/capabilities.c +++ b/libfreerdp-core/capabilities.c @@ -834,10 +834,14 @@ void rdp_write_cache_definition(STREAM* s, GLYPH_CACHE_DEFINITION* cache_definit void rdp_read_glyph_cache_capability_set(STREAM* s, uint16 length, rdpSettings* settings) { + uint16 glyphSupportLevel; + stream_seek(s, 40); /* glyphCache (40 bytes) */ stream_seek_uint32(s); /* fragCache (4 bytes) */ - stream_seek_uint16(s); /* glyphSupportLevel (2 bytes) */ + stream_read_uint16(s, glyphSupportLevel); /* glyphSupportLevel (2 bytes) */ stream_seek_uint16(s); /* pad2Octets (2 bytes) */ + + settings->glyphSupportLevel = glyphSupportLevel; } /** diff --git a/libfreerdp-core/orders.c b/libfreerdp-core/orders.c index 588de8f26..06bb61398 100644 --- a/libfreerdp-core/orders.c +++ b/libfreerdp-core/orders.c @@ -1059,7 +1059,7 @@ void update_read_fast_glyph_order(STREAM* s, ORDER_INFO* orderInfo, FAST_GLYPH_O update_read_2byte_unsigned(s, &glyph->cx); update_read_2byte_unsigned(s, &glyph->cy); glyph->cb = ((glyph->cx + 7) / 8) * glyph->cy; - glyph->cb += glyph->cb % 4; + glyph->cb += ((glyph->cb % 4) > 0) ? 4 - (glyph->cb % 4) : 0; glyph->aj = (uint8*) xmalloc(glyph->cb); stream_read(s, glyph->aj, glyph->cb); fast_glyph->glyph_data = glyph; @@ -1370,19 +1370,22 @@ void update_read_cache_glyph_v2_order(STREAM* s, CACHE_GLYPH_V2_ORDER* cache_gly glyph = (GLYPH_DATA_V2*) xmalloc(sizeof(GLYPH_DATA_V2)); cache_glyph_v2_order->glyphData[i] = glyph; - stream_read_uint16(s, glyph->cacheIndex); + stream_read_uint8(s, glyph->cacheIndex); update_read_2byte_signed(s, &glyph->x); update_read_2byte_signed(s, &glyph->y); update_read_2byte_unsigned(s, &glyph->cx); update_read_2byte_unsigned(s, &glyph->cy); glyph->cb = ((glyph->cx + 7) / 8) * glyph->cy; - glyph->cb += glyph->cb % 4; + glyph->cb += ((glyph->cb % 4) > 0) ? 4 - (glyph->cb % 4) : 0; glyph->aj = (uint8*) xmalloc(glyph->cb); stream_read(s, glyph->aj, glyph->cb); } + + if (flags & CG_GLYPH_UNICODE_PRESENT) + stream_seek(s, cache_glyph_v2_order->cGlyphs * 2); } void update_decompress_brush(STREAM* s, uint8* output, uint8 bpp)