forked from google/skia
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix Google3 fonts. Use fontconfig rather than custom_directory_factor…
…y. Add Google3 font caching. Some future dependents require these changes. Depends on internal cl/108287941. Review URL: https://codereview.chromium.org/1471033002
- Loading branch information
Showing
10 changed files
with
258 additions
and
102 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
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,43 @@ | ||
/* | ||
* Copyright 2009-2015 Google Inc. | ||
* | ||
* Use of this source code is governed by a BSD-style license that can be | ||
* found in the LICENSE file. | ||
*/ | ||
|
||
/* migrated from chrome/src/skia/ext/SkFontHost_fontconfig_direct.cpp */ | ||
|
||
#include "SkFontConfigInterface.h" | ||
#include "SkMutex.h" | ||
|
||
#include <fontconfig/fontconfig.h> | ||
|
||
class SkFontConfigInterfaceDirect : public SkFontConfigInterface { | ||
public: | ||
SkFontConfigInterfaceDirect(); | ||
~SkFontConfigInterfaceDirect() override; | ||
|
||
bool matchFamilyName(const char familyName[], | ||
SkTypeface::Style requested, | ||
FontIdentity* outFontIdentifier, | ||
SkString* outFamilyName, | ||
SkTypeface::Style* outStyle) override; | ||
SkStreamAsset* openStream(const FontIdentity&) override; | ||
|
||
// new APIs | ||
SkDataTable* getFamilyNames() override; | ||
bool matchFamilySet(const char inFamilyName[], | ||
SkString* outFamilyName, | ||
SkTArray<FontIdentity>*) override; | ||
|
||
protected: | ||
virtual bool isAccessible(const char* filename); | ||
|
||
private: | ||
SkMutex mutex_; | ||
|
||
bool isValidPattern(FcPattern* pattern); | ||
FcPattern* MatchFont(FcFontSet* font_set, const char* post_config_family, | ||
const SkString& family); | ||
typedef SkFontConfigInterface INHERITED; | ||
}; |
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,20 @@ | ||
/* | ||
* Copyright 2009-2015 Google Inc. | ||
* | ||
* Use of this source code is governed by a BSD-style license that can be | ||
* found in the LICENSE file. | ||
*/ | ||
|
||
/* migrated from chrome/src/skia/ext/SkFontHost_fontconfig_direct.cpp */ | ||
|
||
#include "SkFontConfigInterface_direct.h" | ||
#include "SkMutex.h" | ||
|
||
SkFontConfigInterface* SkFontConfigInterface::GetSingletonDirectInterface(SkBaseMutex* mutex) { | ||
SkAutoMutexAcquire ac(mutex); | ||
static SkFontConfigInterfaceDirect* singleton = nullptr; | ||
if (singleton == nullptr) { | ||
singleton = new SkFontConfigInterfaceDirect; | ||
} | ||
return singleton; | ||
} |
Oops, something went wrong.