[coretext] Pass buffer direction to CoreText

Have to use a CTTypesetter for this.
pull/51/head
Behdad Esfahbod 10 years ago
parent 5ec45dd37c
commit 4acce77db7
  1. 26
      src/hb-coretext.cc

@ -713,12 +713,28 @@ retry:
kCTFontAttributeName, last_range->font);
}
line = CTLineCreateWithAttributedString (attr_string);
int level = HB_DIRECTION_IS_FORWARD (buffer->props.direction) ? 0 : 1;
CFNumberRef level_number = CFNumberCreate (kCFAllocatorDefault, kCFNumberIntType, &level);
CFDictionaryRef options = CFDictionaryCreate (kCFAllocatorDefault,
(const void **) &kCTTypesetterOptionForcedEmbeddingLevel,
(const void **) &level_number,
1,
&kCFTypeDictionaryKeyCallBacks,
&kCFTypeDictionaryValueCallBacks);
if (unlikely (!options))
FAIL ("CFDictionaryCreate failed");
CTTypesetterRef typesetter = CTTypesetterCreateWithAttributedStringAndOptions (attr_string, options);
CFRelease (options);
CFRelease (attr_string);
}
if (unlikely (!typesetter))
FAIL ("CTTypesetterCreateWithAttributedStringAndOptions failed");
if (unlikely (!line))
FAIL ("CFLineCreateWithAttributedString failed");
line = CTTypesetterCreateLine (typesetter, CFRangeMake(0, 0));
CFRelease (typesetter);
if (unlikely (!line))
FAIL ("CTTypesetterCreateLine failed");
}
CFArrayRef glyph_runs = CTLineGetGlyphRuns (line);
unsigned int num_runs = CFArrayGetCount (glyph_runs);
@ -891,6 +907,8 @@ retry:
}
}
#undef FAIL
fail:
if (string_ref)
CFRelease (string_ref);

Loading…
Cancel
Save