forked from flutter/engine
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add per platform default font family detection. (flutter#4053)
- Loading branch information
1 parent
6e2d67f
commit 8b3e746
Showing
8 changed files
with
68 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// Copyright 2017 The Chromium Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
#include "txt/platform.h" | ||
|
||
namespace txt { | ||
|
||
std::string GetDefaultFontFamily() { | ||
return "Roboto"; | ||
} | ||
|
||
} // namespace txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// Copyright 2017 The Chromium Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
#ifndef TXT_PLATFORM_H_ | ||
#define TXT_PLATFORM_H_ | ||
|
||
#include <string> | ||
#include "lib/ftl/macros.h" | ||
|
||
namespace txt { | ||
|
||
std::string GetDefaultFontFamily(); | ||
|
||
} // namespace txt | ||
|
||
#endif // TXT_PLATFORM_H_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// Copyright 2017 The Chromium Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
#include <TargetConditionals.h> | ||
#include "txt/platform.h" | ||
|
||
#if TARGET_OS_EMBEDDED | ||
#include <UIKit/UIKit.h> | ||
#define FONT_CLASS UIFont | ||
#else // TARGET_OS_EMBEDDED | ||
#include <AppKit/AppKit.h> | ||
#define FONT_CLASS NSFont | ||
#endif // TARGET_OS_EMBEDDED | ||
|
||
namespace txt { | ||
|
||
std::string GetDefaultFontFamily() { | ||
return [FONT_CLASS systemFontOfSize:14].familyName.UTF8String; | ||
} | ||
|
||
} // namespace txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters