Add: [OSX] Text layout using the native CoreText API.
By default, the native API will be used instead of ICU, but if ICU is forced in using configure, it will take precedence.
This commit is contained in:
@@ -25,6 +25,10 @@
|
||||
#include "os/windows/string_uniscribe.h"
|
||||
#endif /* WITH_UNISCRIBE */
|
||||
|
||||
#ifdef WITH_COCOA
|
||||
#include "os/macosx/string_osx.h"
|
||||
#endif
|
||||
|
||||
#include "safeguards.h"
|
||||
|
||||
|
||||
@@ -670,7 +674,7 @@ Layouter::Layouter(const char *str, int maxw, TextColour colour, FontSize fontsi
|
||||
} else {
|
||||
/* Line is new, layout it */
|
||||
FontState old_state = state;
|
||||
#if defined(WITH_ICU_LAYOUT) || defined(WITH_UNISCRIBE)
|
||||
#if defined(WITH_ICU_LAYOUT) || defined(WITH_UNISCRIBE) || defined(WITH_COCOA)
|
||||
const char *old_str = str;
|
||||
#endif
|
||||
|
||||
@@ -698,6 +702,16 @@ Layouter::Layouter(const char *str, int maxw, TextColour colour, FontSize fontsi
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef WITH_COCOA
|
||||
if (line.layout == NULL) {
|
||||
GetLayouter<CoreTextParagraphLayoutFactory>(line, str, state);
|
||||
if (line.layout == NULL) {
|
||||
state = old_state;
|
||||
str = old_str;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if (line.layout == NULL) {
|
||||
GetLayouter<FallbackParagraphLayoutFactory>(line, str, state);
|
||||
}
|
||||
@@ -841,6 +855,9 @@ void Layouter::ResetFontCache(FontSize size)
|
||||
#if defined(WITH_UNISCRIBE)
|
||||
UniscribeResetScriptCache(size);
|
||||
#endif
|
||||
#if defined(WITH_COCOA)
|
||||
MacOSResetScriptCache(size);
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user