2017-01-02 22:53:31 -06:00
|
|
|
// 2 january 2017
|
2016-01-12 00:12:35 -06:00
|
|
|
#import "uipriv_darwin.h"
|
|
|
|
|
2017-01-02 22:53:31 -06:00
|
|
|
struct uiDrawTextLayout {
|
|
|
|
CFAttributedStringRef attrstr;
|
|
|
|
double width;
|
2016-01-12 00:12:35 -06:00
|
|
|
};
|
|
|
|
|
2017-01-02 22:53:31 -06:00
|
|
|
CFAttributedStringRef attrstrToCoreFoundation(uiAttributedString *s, uiDrawFontDescriptor *defaultFont)
|
2016-01-12 00:12:35 -06:00
|
|
|
{
|
|
|
|
CFStringRef cfstr;
|
2017-01-02 22:53:31 -06:00
|
|
|
CFAttributedStringRef base;
|
|
|
|
CFMutableAttributedStringRef mas;
|
|
|
|
CFMutableDictionaryRef defaultAttrs;
|
2016-01-12 00:12:35 -06:00
|
|
|
|
2017-01-02 22:53:31 -06:00
|
|
|
cfstr = CFStringCreateWithCharacters(NULL, attrstrUTF16(s), attrstrUTF16Len(s));
|
|
|
|
if (cfstr == NULL) {
|
|
|
|
// TODO
|
2016-01-12 00:12:35 -06:00
|
|
|
}
|
2017-01-02 22:53:31 -06:00
|
|
|
defaultAttrs = CFDictionaryCreateMutable(NULL, 4,
|
|
|
|
&kCFCopyStringDictionaryKeyCallBacks,
|
|
|
|
&kCFTypeDictionaryValueCallBacks);
|
|
|
|
if (defaultAttrs == NULL) {
|
|
|
|
// TODO
|
2016-01-12 00:12:35 -06:00
|
|
|
}
|
|
|
|
|
2017-01-02 22:53:31 -06:00
|
|
|
base = CFAttributedStringCreate(NULL, cfstr, defaultAttrs);
|
|
|
|
if (base == NULL) {
|
|
|
|
// TODO
|
2016-01-12 00:12:35 -06:00
|
|
|
}
|
2017-01-02 22:53:31 -06:00
|
|
|
CFRelease(cfstr);
|
|
|
|
CFRelease(defaultAttrs);
|
|
|
|
mas = CFAttributedStringCreateMutableCopy(NULL, 0, base);
|
|
|
|
CFRelease(base);
|
2016-01-12 00:46:28 -06:00
|
|
|
|
2017-01-02 22:53:31 -06:00
|
|
|
CFAttributedStringBeginEditing(mas);
|
|
|
|
// TODO copy in the attributes
|
|
|
|
CFAttributedStringEndEditing(mas);
|
2016-01-12 00:12:35 -06:00
|
|
|
|
2017-01-02 22:53:31 -06:00
|
|
|
return mas;
|
2016-01-12 00:46:28 -06:00
|
|
|
}
|
|
|
|
|
2017-01-02 22:53:31 -06:00
|
|
|
uiDrawTextLayout *uiDrawNewTextLayout(uiAttributedString *s, uiDrawFontDescriptor *defaultFont, double width)
|
2016-01-12 00:46:28 -06:00
|
|
|
{
|
2016-01-12 00:12:35 -06:00
|
|
|
}
|
|
|
|
|
2017-01-02 22:53:31 -06:00
|
|
|
void uiDrawFreeTextLayout(uiDrawTextLayout *tl)
|
2016-01-12 00:12:35 -06:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2017-01-02 22:53:31 -06:00
|
|
|
void uiDrawText(uiDrawContext *c, uiDrawTextLayout *tl, double x, double y)
|
2016-01-15 19:18:53 -06:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2017-01-02 22:53:31 -06:00
|
|
|
void uiDrawTextLayoutExtents(uiDrawTextLayout *tl, double *width, double *height)
|
2016-01-16 12:34:22 -06:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2017-01-02 22:53:31 -06:00
|
|
|
int uiDrawTextLayoutNumLines(uiDrawTextLayout *tl)
|
2016-01-16 12:34:22 -06:00
|
|
|
{
|
|
|
|
}
|
2016-01-15 21:48:38 -06:00
|
|
|
|
2017-01-02 22:53:31 -06:00
|
|
|
void uiDrawTextLayoutLineByteRange(uiDrawTextLayout *tl, int line, size_t *start, size_t *end)
|
2016-01-15 19:18:53 -06:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2017-01-02 22:53:31 -06:00
|
|
|
void uiDrawTextLayoutLineGetMetrics(uiDrawTextLayout *tl, int line, uiDrawTextLayoutLineMetrics *m)
|
2016-01-12 00:12:35 -06:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2017-01-02 22:53:31 -06:00
|
|
|
void uiDrawTextLayoutByteIndexToGraphemeRect(uiDrawTextLayout *tl, size_t pos, int *line, double *x, double *y, double *width, double *height)
|
2016-01-12 00:12:35 -06:00
|
|
|
{
|
|
|
|
}
|
2016-01-13 14:17:49 -06:00
|
|
|
|
2017-01-02 22:53:31 -06:00
|
|
|
uiDrawTextLayoutHitTestResult uiDrawTextLayoutHitTest(uiDrawTextLayout *tl, double x, double y, size_t *byteIndex, int *line)
|
2016-05-23 00:11:43 -05:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2017-01-02 22:53:31 -06:00
|
|
|
void uiDrawTextLayoutByteRangeToRectangle(uiDrawTextLayout *tl, size_t start, size_t end, uiDrawTextLayoutByteRangeRectangle *r)
|
2016-04-19 15:06:50 -05:00
|
|
|
{
|
|
|
|
}
|