summaryrefslogtreecommitdiff
path: root/pango/pangocoretext.c
diff options
context:
space:
mode:
authorKristian Rietveld <kris@loopnest.org>2015-09-05 23:13:18 +0200
committerKristian Rietveld <kris@loopnest.org>2016-04-24 11:47:17 +0200
commit7e6fe2c381c307619215a1f7661dd5c609b22c39 (patch)
tree07cc621a7ef94d36fb669d326f9589cd3eb2203c /pango/pangocoretext.c
parent550fba61eea3cae292d4b2abbffbe8a7a99a50b4 (diff)
downloadpango-7e6fe2c381c307619215a1f7661dd5c609b22c39.tar.gz
coretext: implement obtaining coverage of supplementary planes
Diffstat (limited to 'pango/pangocoretext.c')
-rw-r--r--pango/pangocoretext.c32
1 files changed, 28 insertions, 4 deletions
diff --git a/pango/pangocoretext.c b/pango/pangocoretext.c
index b8f79aeb..a8c0b5d2 100644
--- a/pango/pangocoretext.c
+++ b/pango/pangocoretext.c
@@ -84,7 +84,8 @@ ct_font_descriptor_get_coverage (CTFontDescriptorRef desc)
CFCharacterSetRef charset;
CFIndex i, length;
CFDataRef bitmap;
- const UInt8 *ptr;
+ const UInt8 *ptr, *plane_ptr;
+ const UInt32 plane_size = 8192;
PangoCoverage *coverage;
coverage = pango_coverage_new ();
@@ -96,11 +97,11 @@ ct_font_descriptor_get_coverage (CTFontDescriptorRef desc)
bitmap = CFCharacterSetCreateBitmapRepresentation (kCFAllocatorDefault,
charset);
-
- /* We only handle the BMP plane */
- length = MIN (CFDataGetLength (bitmap), 8192);
ptr = CFDataGetBytePtr (bitmap);
+ /* First handle the BMP plane. */
+ length = MIN (CFDataGetLength (bitmap), plane_size);
+
/* FIXME: can and should this be done more efficiently? */
for (i = 0; i < length; i++)
{
@@ -111,6 +112,29 @@ ct_font_descriptor_get_coverage (CTFontDescriptorRef desc)
pango_coverage_set (coverage, i * 8 + j, PANGO_COVERAGE_EXACT);
}
+ /* Next, handle the other planes. The plane number is encoded first as
+ * a single byte. In the following 8192 bytes that plane's coverage bitmap
+ * is stored.
+ */
+ plane_ptr = ptr + plane_size;
+ while (plane_ptr - ptr < CFDataGetLength (bitmap))
+ {
+ const UInt8 plane_number = *plane_ptr;
+ plane_ptr++;
+
+ for (i = 0; i < plane_size; i++)
+ {
+ int j;
+
+ for (j = 0; j < 8; j++)
+ if ((plane_ptr[i] & (1 << j)) == (1 << j))
+ pango_coverage_set (coverage, (plane_number * plane_size + i) * 8 + j,
+ PANGO_COVERAGE_EXACT);
+ }
+
+ plane_ptr += plane_size;
+ }
+
CFRelease (bitmap);
CFRelease (charset);