OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "base/values.h" |
| 6 #include "content/common/fontmgr_messages.h" |
| 7 #include "content/common/fontmgr_proxy.h" |
| 8 #include "content/renderer/render_thread_impl.h" |
| 9 #include "third_party/skia/include/core/SkDataTable.h" |
| 10 #include "third_party/skia/include/core/SkStream.h" |
| 11 #include "third_party/skia/include/ports/SkFontMgr_indirect.h" |
| 12 |
| 13 namespace content { |
| 14 |
| 15 SkDataTable* FontMgrProxy::getFamilyNames() const { |
| 16 skia::RefPtr<SkDataTable> familyNames; |
| 17 content::RenderThreadImpl::current()->Send( |
| 18 new FontMsg_GetFamilyNames(FontMsgStart, &familyNames)); |
| 19 return SkSafeRef(familyNames.get()); |
| 20 } |
| 21 |
| 22 SkRemotableFontIdentitySet* FontMgrProxy::getIndexIdentities( |
| 23 int familyIndex) const |
| 24 { |
| 25 skia::RefPtr<SkRemotableFontIdentitySet> identities; |
| 26 content::RenderThreadImpl::current()->Send( |
| 27 new FontMsg_GetIndexIdentities(FontMsgStart, familyIndex, &identities)); |
| 28 return SkSafeRef(identities.get()); |
| 29 } |
| 30 |
| 31 SkFontIdentity FontMgrProxy::matchIndexStyle( |
| 32 int familyIndex, const SkFontStyle& style) const |
| 33 { |
| 34 SkFontIdentity identity; |
| 35 content::RenderThreadImpl::current()->Send( |
| 36 new FontMsg_MatchIndexStyle(FontMsgStart, familyIndex, style, &identity)); |
| 37 return identity; |
| 38 } |
| 39 |
| 40 SkRemotableFontIdentitySet* FontMgrProxy::matchName( |
| 41 const char familyName[]) const |
| 42 { |
| 43 skia::RefPtr<SkRemotableFontIdentitySet> identities; |
| 44 content::RenderThreadImpl::current()->Send( |
| 45 new FontMsg_MatchName(FontMsgStart, SkString(familyName), &identities)); |
| 46 return SkSafeRef(identities.get()); |
| 47 } |
| 48 |
| 49 SkFontIdentity FontMgrProxy::matchNameStyle( |
| 50 const char familyName[], const SkFontStyle& style) const |
| 51 { |
| 52 SkFontIdentity identity; |
| 53 content::RenderThreadImpl::current()->Send( |
| 54 new FontMsg_MatchNameStyle(FontMsgStart, SkString(familyName), style, |
| 55 &identity)); |
| 56 return identity; |
| 57 } |
| 58 |
| 59 SkFontIdentity FontMgrProxy::matchNameStyleCharacter( |
| 60 const char familyName[], const SkFontStyle& style, |
| 61 const char bpc47[], uint32_t character) const |
| 62 { |
| 63 SkFontIdentity identity; |
| 64 content::RenderThreadImpl::current()->Send( |
| 65 new FontMsg_MatchNameStyleCharacter(FontMsgStart, SkString(familyName), |
| 66 style, SkString(bpc47), character, |
| 67 &identity)); |
| 68 return identity; |
| 69 } |
| 70 |
| 71 SkStream* FontMgrProxy::getData(int dataId) const { |
| 72 skia::RefPtr<SkStream> stream; |
| 73 content::RenderThreadImpl::current()->Send( |
| 74 new FontMsg_GetData(FontMsgStart, dataId, &stream)); |
| 75 return SkSafeRef(stream.get()); |
| 76 } |
| 77 |
| 78 } // namespace content |
OLD | NEW |