libtxt: use Helvetica as a fallback font on iOS 8 and earlier (flutter/engine#4930)

Fixes https://github.com/flutter/flutter/issues/16055
This commit is contained in:
Jason Simmons
2018-04-04 09:37:51 -07:00
committed by GitHub
parent 5c21933363
commit 414fef2430

View File

@@ -3,6 +3,7 @@
// found in the LICENSE file.
#include <TargetConditionals.h>
#include "flutter/fml/platform/darwin/platform_version.h"
#include "txt/platform.h"
#if TARGET_OS_EMBEDDED || TARGET_OS_SIMULATOR
@@ -16,7 +17,11 @@
namespace txt {
std::string GetDefaultFontFamily() {
return [FONT_CLASS systemFontOfSize:14].familyName.UTF8String;
if (fml::IsPlatformVersionAtLeast(9)) {
return [FONT_CLASS systemFontOfSize:14].familyName.UTF8String;
} else {
return "Helvetica";
}
}
} // namespace txt