| Index: content/common/fontmgr_proxy.cc
|
| ===================================================================
|
| --- content/common/fontmgr_proxy.cc (revision 0)
|
| +++ content/common/fontmgr_proxy.cc (working copy)
|
| @@ -0,0 +1,78 @@
|
| +// Copyright (c) 2014 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 "base/values.h"
|
| +#include "content/common/fontmgr_messages.h"
|
| +#include "content/common/fontmgr_proxy.h"
|
| +#include "content/renderer/render_thread_impl.h"
|
| +#include "third_party/skia/include/core/SkDataTable.h"
|
| +#include "third_party/skia/include/core/SkStream.h"
|
| +#include "third_party/skia/include/ports/SkFontMgr_indirect.h"
|
| +
|
| +namespace content {
|
| +
|
| +SkDataTable* FontMgrProxy::getFamilyNames() const {
|
| + skia::RefPtr<SkDataTable> familyNames;
|
| + content::RenderThreadImpl::current()->Send(
|
| + new FontMsg_GetFamilyNames(FontMsgStart, &familyNames));
|
| + return SkSafeRef(familyNames.get());
|
| +}
|
| +
|
| +SkRemotableFontIdentitySet* FontMgrProxy::getIndexIdentities(
|
| + int familyIndex) const
|
| +{
|
| + skia::RefPtr<SkRemotableFontIdentitySet> identities;
|
| + content::RenderThreadImpl::current()->Send(
|
| + new FontMsg_GetIndexIdentities(FontMsgStart, familyIndex, &identities));
|
| + return SkSafeRef(identities.get());
|
| +}
|
| +
|
| +SkFontIdentity FontMgrProxy::matchIndexStyle(
|
| + int familyIndex, const SkFontStyle& style) const
|
| +{
|
| + SkFontIdentity identity;
|
| + content::RenderThreadImpl::current()->Send(
|
| + new FontMsg_MatchIndexStyle(FontMsgStart, familyIndex, style, &identity));
|
| + return identity;
|
| +}
|
| +
|
| +SkRemotableFontIdentitySet* FontMgrProxy::matchName(
|
| + const char familyName[]) const
|
| +{
|
| + skia::RefPtr<SkRemotableFontIdentitySet> identities;
|
| + content::RenderThreadImpl::current()->Send(
|
| + new FontMsg_MatchName(FontMsgStart, SkString(familyName), &identities));
|
| + return SkSafeRef(identities.get());
|
| +}
|
| +
|
| +SkFontIdentity FontMgrProxy::matchNameStyle(
|
| + const char familyName[], const SkFontStyle& style) const
|
| +{
|
| + SkFontIdentity identity;
|
| + content::RenderThreadImpl::current()->Send(
|
| + new FontMsg_MatchNameStyle(FontMsgStart, SkString(familyName), style,
|
| + &identity));
|
| + return identity;
|
| +}
|
| +
|
| +SkFontIdentity FontMgrProxy::matchNameStyleCharacter(
|
| + const char familyName[], const SkFontStyle& style,
|
| + const char bpc47[], uint32_t character) const
|
| +{
|
| + SkFontIdentity identity;
|
| + content::RenderThreadImpl::current()->Send(
|
| + new FontMsg_MatchNameStyleCharacter(FontMsgStart, SkString(familyName),
|
| + style, SkString(bpc47), character,
|
| + &identity));
|
| + return identity;
|
| +}
|
| +
|
| +SkStream* FontMgrProxy::getData(int dataId) const {
|
| + skia::RefPtr<SkStream> stream;
|
| + content::RenderThreadImpl::current()->Send(
|
| + new FontMsg_GetData(FontMsgStart, dataId, &stream));
|
| + return SkSafeRef(stream.get());
|
| +}
|
| +
|
| +} // namespace content
|
|
|