Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
sxychenjing
engine
提交
35c66714
E
engine
项目概览
sxychenjing
/
engine
与 Fork 源项目一致
从无法访问的项目Fork
通知
3
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
E
engine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
35c66714
编写于
8月 11, 2016
作者:
A
Adam Barth
提交者:
GitHub
8月 11, 2016
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Remove more public headers (#2914)
These aren't needed anymore.
上级
c6f67824
变更
15
隐藏空白更改
内联
并排
Showing
15 changed file
with
302 addition
and
1296 deletion
+302
-1296
sky/engine/platform/BUILD.gn
sky/engine/platform/BUILD.gn
+0
-4
sky/engine/platform/exported/WebCString.cpp
sky/engine/platform/exported/WebCString.cpp
+0
-101
sky/engine/platform/exported/linux/WebFontInfo.cpp
sky/engine/platform/exported/linux/WebFontInfo.cpp
+0
-266
sky/engine/platform/exported/linux/WebFontRenderStyle.cpp
sky/engine/platform/exported/linux/WebFontRenderStyle.cpp
+0
-61
sky/engine/platform/fonts/linux/FontCacheLinux.cpp
sky/engine/platform/fonts/linux/FontCacheLinux.cpp
+234
-17
sky/engine/platform/fonts/linux/FontPlatformDataLinux.cpp
sky/engine/platform/fonts/linux/FontPlatformDataLinux.cpp
+68
-72
sky/engine/public/BUILD.gn
sky/engine/public/BUILD.gn
+0
-6
sky/engine/public/platform/Platform.h
sky/engine/public/platform/Platform.h
+0
-1
sky/engine/public/platform/WebCString.h
sky/engine/public/platform/WebCString.h
+0
-132
sky/engine/public/platform/WebNonCopyable.h
sky/engine/public/platform/WebNonCopyable.h
+0
-49
sky/engine/public/platform/WebPrivatePtr.h
sky/engine/public/platform/WebPrivatePtr.h
+0
-210
sky/engine/public/platform/WebVector.h
sky/engine/public/platform/WebVector.h
+0
-201
sky/engine/public/platform/linux/WebFallbackFont.h
sky/engine/public/platform/linux/WebFallbackFont.h
+0
-57
sky/engine/public/platform/linux/WebFontInfo.h
sky/engine/public/platform/linux/WebFontInfo.h
+0
-56
sky/engine/public/platform/linux/WebFontRenderStyle.h
sky/engine/public/platform/linux/WebFontRenderStyle.h
+0
-63
未找到文件。
sky/engine/platform/BUILD.gn
浏览文件 @
35c66714
...
...
@@ -40,10 +40,7 @@ source_set("platform") {
"animation/UnitBezier.h",
"exported/Platform.cpp",
"exported/sky_settings.cc",
"exported/WebCString.cpp",
"exported/WebCommon.cpp",
"exported/linux/WebFontInfo.cpp",
"exported/linux/WebFontRenderStyle.cpp",
"fonts/AlternateFontFamily.h",
"fonts/Character.cpp",
"fonts/Character.h",
...
...
@@ -316,7 +313,6 @@ source_set("platform") {
# Add in some Linux files also shared with Android.
set_sources_assignment_filter([])
sources += [
"exported/linux/WebFontRenderStyle.cpp",
"fonts/linux/FontPlatformDataLinux.cpp",
]
set_sources_assignment_filter(sources_assignment_filter)
...
...
sky/engine/platform/exported/WebCString.cpp
已删除
100644 → 0
浏览文件 @
c6f67824
/*
* Copyright (C) 2009 Google Inc. All rights reserved.
* Copyright (C) 2012 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following disclaimer
* in the documentation and/or other materials provided with the
* distribution.
* * Neither the name of Google Inc. nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "flutter/sky/engine/public/platform/WebCString.h"
#include <string.h>
#include "flutter/sky/engine/wtf/text/CString.h"
namespace
blink
{
int
WebCString
::
compare
(
const
WebCString
&
other
)
const
{
// A null string is always less than a non null one.
if
(
isNull
()
!=
other
.
isNull
())
return
isNull
()
?
-
1
:
1
;
if
(
isNull
())
return
0
;
// Both WebCStrings are null.
return
strcmp
(
m_private
->
data
(),
other
.
m_private
->
data
());
}
void
WebCString
::
reset
()
{
m_private
.
reset
();
}
void
WebCString
::
assign
(
const
WebCString
&
other
)
{
assign
(
other
.
m_private
.
get
());
}
void
WebCString
::
assign
(
const
char
*
data
,
size_t
length
)
{
char
*
newData
;
RefPtr
<
WTF
::
CStringBuffer
>
buffer
=
WTF
::
CString
::
newUninitialized
(
length
,
newData
).
buffer
();
memcpy
(
newData
,
data
,
length
);
assign
(
buffer
.
get
());
}
size_t
WebCString
::
length
()
const
{
return
m_private
.
isNull
()
?
0
:
m_private
->
length
();
}
const
char
*
WebCString
::
data
()
const
{
return
m_private
.
isNull
()
?
0
:
m_private
->
data
();
}
WebCString
::
WebCString
(
const
WTF
::
CString
&
s
)
{
assign
(
s
.
buffer
());
}
WebCString
&
WebCString
::
operator
=
(
const
WTF
::
CString
&
s
)
{
assign
(
s
.
buffer
());
return
*
this
;
}
WebCString
::
operator
WTF
::
CString
()
const
{
return
m_private
.
get
();
}
void
WebCString
::
assign
(
WTF
::
CStringBuffer
*
p
)
{
m_private
=
p
;
}
}
// namespace blink
sky/engine/platform/exported/linux/WebFontInfo.cpp
已删除
100644 → 0
浏览文件 @
c6f67824
/*
* Copyright (C) 2009 Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following disclaimer
* in the documentation and/or other materials provided with the
* distribution.
* * Neither the name of Google Inc. nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "flutter/sky/engine/public/platform/linux/WebFontInfo.h"
#include <fontconfig/fontconfig.h>
#include <string.h>
#include <unicode/utf16.h>
#include "flutter/sky/engine/public/platform/linux/WebFallbackFont.h"
#include "flutter/sky/engine/wtf/HashMap.h"
#include "flutter/sky/engine/wtf/Noncopyable.h"
#include "flutter/sky/engine/wtf/OwnPtr.h"
#include "flutter/sky/engine/wtf/PassOwnPtr.h"
#include "flutter/sky/engine/wtf/Vector.h"
#include "flutter/sky/engine/wtf/text/AtomicString.h"
#include "flutter/sky/engine/wtf/text/AtomicStringHash.h"
namespace
blink
{
class
CachedFont
{
public:
// Note: We pass the charset explicitly as callers
// should not create CachedFont entries without knowing
// that the FcPattern contains a valid charset.
CachedFont
(
FcPattern
*
pattern
,
FcCharSet
*
charSet
)
:
m_supportedCharacters
(
charSet
)
{
ASSERT
(
pattern
);
ASSERT
(
charSet
);
m_fallbackFont
.
name
=
fontName
(
pattern
);
m_fallbackFont
.
filename
=
fontFilename
(
pattern
);
m_fallbackFont
.
ttcIndex
=
fontTtcIndex
(
pattern
);
m_fallbackFont
.
isBold
=
fontIsBold
(
pattern
);
m_fallbackFont
.
isItalic
=
fontIsItalic
(
pattern
);
}
const
WebFallbackFont
&
fallbackFont
()
const
{
return
m_fallbackFont
;
}
bool
hasGlyphForCharacter
(
WebUChar32
c
)
{
return
m_supportedCharacters
&&
FcCharSetHasChar
(
m_supportedCharacters
,
c
);
}
private:
static
WebCString
fontName
(
FcPattern
*
pattern
)
{
FcChar8
*
familyName
=
nullptr
;
if
(
FcPatternGetString
(
pattern
,
FC_FAMILY
,
0
,
&
familyName
)
!=
FcResultMatch
)
return
WebCString
();
// FCChar8 is unsigned char, so we cast to char for WebCString.
const
char
*
charFamily
=
reinterpret_cast
<
char
*>
(
familyName
);
return
WebCString
(
charFamily
,
strlen
(
charFamily
));
}
static
WebCString
fontFilename
(
FcPattern
*
pattern
)
{
FcChar8
*
cFilename
=
nullptr
;
if
(
FcPatternGetString
(
pattern
,
FC_FILE
,
0
,
&
cFilename
)
!=
FcResultMatch
)
return
WebCString
();
const
char
*
fontFilename
=
reinterpret_cast
<
char
*>
(
cFilename
);
return
WebCString
(
fontFilename
,
strlen
(
fontFilename
));
}
static
int
fontTtcIndex
(
FcPattern
*
pattern
)
{
int
ttcIndex
=
-
1
;
if
(
FcPatternGetInteger
(
pattern
,
FC_INDEX
,
0
,
&
ttcIndex
)
!=
FcResultMatch
||
ttcIndex
<
0
)
return
0
;
return
ttcIndex
;
}
static
bool
fontIsBold
(
FcPattern
*
pattern
)
{
int
weight
=
0
;
if
(
FcPatternGetInteger
(
pattern
,
FC_WEIGHT
,
0
,
&
weight
)
!=
FcResultMatch
)
return
false
;
return
weight
>=
FC_WEIGHT_BOLD
;
}
static
bool
fontIsItalic
(
FcPattern
*
pattern
)
{
int
slant
=
0
;
if
(
FcPatternGetInteger
(
pattern
,
FC_SLANT
,
0
,
&
slant
)
!=
FcResultMatch
)
return
false
;
return
slant
!=
FC_SLANT_ROMAN
;
}
WebFallbackFont
m_fallbackFont
;
// m_supportedCharaters is owned by the parent
// FcFontSet and should never be freed.
FcCharSet
*
m_supportedCharacters
;
};
class
CachedFontSet
{
WTF_MAKE_NONCOPYABLE
(
CachedFontSet
);
public:
// CachedFontSet takes ownership of the passed FcFontSet.
static
PassOwnPtr
<
CachedFontSet
>
createForLocale
(
const
char
*
locale
)
{
FcFontSet
*
fontSet
=
createFcFontSetForLocale
(
locale
);
return
adoptPtr
(
new
CachedFontSet
(
fontSet
));
}
~
CachedFontSet
()
{
m_fallbackList
.
clear
();
FcFontSetDestroy
(
m_fontSet
);
}
WebFallbackFont
fallbackFontForChar
(
WebUChar32
c
)
{
Vector
<
CachedFont
>::
iterator
itr
=
m_fallbackList
.
begin
();
for
(;
itr
!=
m_fallbackList
.
end
();
itr
++
)
{
if
(
itr
->
hasGlyphForCharacter
(
c
))
return
itr
->
fallbackFont
();
}
// The previous code just returned garbage if the user didn't
// have the necessary fonts, this seems better than garbage.
// Current callers happen to ignore any values with an empty family string.
return
WebFallbackFont
();
}
private:
static
FcFontSet
*
createFcFontSetForLocale
(
const
char
*
locale
)
{
FcPattern
*
pattern
=
FcPatternCreate
();
if
(
locale
)
{
// FcChar* is unsigned char* so we have to cast.
FcPatternAddString
(
pattern
,
FC_LANG
,
reinterpret_cast
<
const
FcChar8
*>
(
locale
));
}
FcValue
fcvalue
;
fcvalue
.
type
=
FcTypeBool
;
fcvalue
.
u
.
b
=
FcTrue
;
FcPatternAdd
(
pattern
,
FC_SCALABLE
,
fcvalue
,
FcFalse
);
FcConfigSubstitute
(
0
,
pattern
,
FcMatchPattern
);
FcDefaultSubstitute
(
pattern
);
if
(
!
locale
)
FcPatternDel
(
pattern
,
FC_LANG
);
// The result parameter returns if any fonts were found.
// We already handle 0 fonts correctly, so we ignore the param.
FcResult
result
;
FcFontSet
*
fontSet
=
FcFontSort
(
0
,
pattern
,
0
,
0
,
&
result
);
FcPatternDestroy
(
pattern
);
// The caller will take ownership of this FcFontSet.
return
fontSet
;
}
CachedFontSet
(
FcFontSet
*
fontSet
)
:
m_fontSet
(
fontSet
)
{
fillFallbackList
();
}
void
fillFallbackList
()
{
ASSERT
(
m_fallbackList
.
isEmpty
());
if
(
!
m_fontSet
)
return
;
for
(
int
i
=
0
;
i
<
m_fontSet
->
nfont
;
++
i
)
{
FcPattern
*
pattern
=
m_fontSet
->
fonts
[
i
];
// Ignore any bitmap fonts users may still have installed from last century.
FcBool
isScalable
;
if
(
FcPatternGetBool
(
pattern
,
FC_SCALABLE
,
0
,
&
isScalable
)
!=
FcResultMatch
||
!
isScalable
)
continue
;
// Ignore any fonts FontConfig knows about, but that we don't have permission to read.
FcChar8
*
cFilename
;
if
(
FcPatternGetString
(
pattern
,
FC_FILE
,
0
,
&
cFilename
)
!=
FcResultMatch
)
continue
;
if
(
access
(
reinterpret_cast
<
char
*>
(
cFilename
),
R_OK
))
continue
;
// Make sure this font can tell us what characters it has glyphs for.
FcCharSet
*
charSet
;
if
(
FcPatternGetCharSet
(
pattern
,
FC_CHARSET
,
0
,
&
charSet
)
!=
FcResultMatch
)
continue
;
m_fallbackList
.
append
(
CachedFont
(
pattern
,
charSet
));
}
}
FcFontSet
*
m_fontSet
;
// Owned by this object.
// CachedFont has a FcCharset* which points into the FcFontSet.
// If the FcFontSet is ever destroyed, the fallbackList
// must be cleared first.
Vector
<
CachedFont
>
m_fallbackList
;
};
class
FontSetCache
{
public:
static
FontSetCache
&
shared
()
{
DEFINE_STATIC_LOCAL
(
FontSetCache
,
cache
,
());
return
cache
;
}
WebFallbackFont
fallbackFontForCharInLocale
(
WebUChar32
c
,
const
char
*
locale
)
{
DEFINE_STATIC_LOCAL
(
AtomicString
,
kNoLocale
,
(
"NO_LOCALE_SPECIFIED"
));
AtomicString
localeKey
;
if
(
locale
&&
strlen
(
locale
))
{
localeKey
=
AtomicString
(
locale
);
}
else
{
// String hash computation the m_setsByLocale map needs
// a non-empty string.
localeKey
=
kNoLocale
;
}
LocaleToCachedFont
::
iterator
itr
=
m_setsByLocale
.
find
(
localeKey
);
if
(
itr
==
m_setsByLocale
.
end
())
{
OwnPtr
<
CachedFontSet
>
newEntry
=
CachedFontSet
::
createForLocale
(
strlen
(
locale
)
?
locale
:
0
);
return
m_setsByLocale
.
add
(
localeKey
,
newEntry
.
release
()).
storedValue
->
value
->
fallbackFontForChar
(
c
);
}
return
itr
.
get
()
->
value
->
fallbackFontForChar
(
c
);
}
// FIXME: We may wish to add a way to prune the cache at a later time.
private:
// FIXME: This shouldn't need to be AtomicString, but
// currently HashTraits<const char*> isn't smart enough
// to hash the string (only does pointer compares).
typedef
HashMap
<
AtomicString
,
OwnPtr
<
CachedFontSet
>
>
LocaleToCachedFont
;
LocaleToCachedFont
m_setsByLocale
;
};
void
WebFontInfo
::
fallbackFontForChar
(
WebUChar32
c
,
const
char
*
locale
,
WebFallbackFont
*
fallbackFont
)
{
*
fallbackFont
=
FontSetCache
::
shared
().
fallbackFontForCharInLocale
(
c
,
locale
);
}
}
// namespace blink
sky/engine/platform/exported/linux/WebFontRenderStyle.cpp
已删除
100644 → 0
浏览文件 @
c6f67824
/*
* Copyright (C) 2010 Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following disclaimer
* in the documentation and/or other materials provided with the
* distribution.
* * Neither the name of Google Inc. nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "flutter/sky/engine/public/platform/linux/WebFontRenderStyle.h"
#include "flutter/sky/engine/platform/fonts/FontRenderStyle.h"
using
blink
::
FontRenderStyle
;
namespace
blink
{
void
WebFontRenderStyle
::
toFontRenderStyle
(
FontRenderStyle
*
out
)
{
out
->
useBitmaps
=
useBitmaps
;
out
->
useAutoHint
=
useAutoHint
;
out
->
useHinting
=
useHinting
;
out
->
hintStyle
=
hintStyle
;
out
->
useAntiAlias
=
useAntiAlias
;
out
->
useSubpixelRendering
=
useSubpixelRendering
;
out
->
useSubpixelPositioning
=
useSubpixelPositioning
;
}
void
WebFontRenderStyle
::
setDefaults
()
{
useBitmaps
=
2
;
useAutoHint
=
2
;
useHinting
=
2
;
hintStyle
=
0
;
useAntiAlias
=
2
;
useSubpixelRendering
=
2
;
useSubpixelPositioning
=
2
;
}
}
// namespace blink
sky/engine/platform/fonts/linux/FontCacheLinux.cpp
浏览文件 @
35c66714
...
...
@@ -10,38 +10,255 @@
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
* THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND
* ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
* DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR
* ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "flutter/sky/engine/platform/fonts/FontCache.h"
#include <fontconfig/fontconfig.h>
#include <string.h>
#include <unicode/utf16.h>
#include <unistd.h>
#include "flutter/sky/engine/public/platform/Platform.h"
#include "flutter/sky/engine/public/platform/linux/WebFallbackFont.h"
#include "flutter/sky/engine/public/platform/linux/WebFontInfo.h"
#include "flutter/sky/engine/wtf/HashMap.h"
#include "flutter/sky/engine/wtf/Noncopyable.h"
#include "flutter/sky/engine/wtf/OwnPtr.h"
#include "flutter/sky/engine/wtf/PassOwnPtr.h"
#include "flutter/sky/engine/wtf/text/AtomicString.h"
#include "flutter/sky/engine/wtf/text/AtomicStringHash.h"
#include "flutter/sky/engine/wtf/text/CString.h"
#include "flutter/sky/engine/wtf/Vector.h"
namespace
blink
{
void
FontCache
::
getFontForCharacter
(
UChar32
c
,
const
char
*
preferredLocale
,
FontCache
::
PlatformFallbackFont
*
fallbackFont
)
{
WebFallbackFont
webFallbackFont
;
WebFontInfo
::
fallbackFontForChar
(
c
,
preferredLocale
,
&
webFallbackFont
);
fallbackFont
->
name
=
String
::
fromUTF8
(
CString
(
webFallbackFont
.
name
));
fallbackFont
->
filename
=
webFallbackFont
.
filename
;
fallbackFont
->
fontconfigInterfaceId
=
webFallbackFont
.
fontconfigInterfaceId
;
fallbackFont
->
ttcIndex
=
webFallbackFont
.
ttcIndex
;
fallbackFont
->
isBold
=
webFallbackFont
.
isBold
;
fallbackFont
->
isItalic
=
webFallbackFont
.
isItalic
;
class
CachedFont
{
public:
// Note: We pass the charset explicitly as callers
// should not create CachedFont entries without knowing
// that the FcPattern contains a valid charset.
CachedFont
(
FcPattern
*
pattern
,
FcCharSet
*
charSet
)
:
m_supportedCharacters
(
charSet
)
{
ASSERT
(
pattern
);
ASSERT
(
charSet
);
m_fallbackFont
.
name
=
fontName
(
pattern
);
m_fallbackFont
.
filename
=
fontFilename
(
pattern
);
m_fallbackFont
.
ttcIndex
=
fontTtcIndex
(
pattern
);
m_fallbackFont
.
isBold
=
fontIsBold
(
pattern
);
m_fallbackFont
.
isItalic
=
fontIsItalic
(
pattern
);
}
const
FontCache
::
PlatformFallbackFont
&
fallbackFont
()
const
{
return
m_fallbackFont
;
}
bool
hasGlyphForCharacter
(
UChar32
c
)
{
return
m_supportedCharacters
&&
FcCharSetHasChar
(
m_supportedCharacters
,
c
);
}
private:
static
String
fontName
(
FcPattern
*
pattern
)
{
FcChar8
*
familyName
=
nullptr
;
if
(
FcPatternGetString
(
pattern
,
FC_FAMILY
,
0
,
&
familyName
)
!=
FcResultMatch
)
return
String
();
// FCChar8 is unsigned char, so we cast to char for CString.
const
char
*
charFamily
=
reinterpret_cast
<
char
*>
(
familyName
);
return
String
::
fromUTF8
(
charFamily
,
strlen
(
charFamily
));
}
static
CString
fontFilename
(
FcPattern
*
pattern
)
{
FcChar8
*
cFilename
=
nullptr
;
if
(
FcPatternGetString
(
pattern
,
FC_FILE
,
0
,
&
cFilename
)
!=
FcResultMatch
)
return
CString
();
const
char
*
fontFilename
=
reinterpret_cast
<
char
*>
(
cFilename
);
return
CString
(
fontFilename
,
strlen
(
fontFilename
));
}
static
int
fontTtcIndex
(
FcPattern
*
pattern
)
{
int
ttcIndex
=
-
1
;
if
(
FcPatternGetInteger
(
pattern
,
FC_INDEX
,
0
,
&
ttcIndex
)
!=
FcResultMatch
||
ttcIndex
<
0
)
return
0
;
return
ttcIndex
;
}
static
bool
fontIsBold
(
FcPattern
*
pattern
)
{
int
weight
=
0
;
if
(
FcPatternGetInteger
(
pattern
,
FC_WEIGHT
,
0
,
&
weight
)
!=
FcResultMatch
)
return
false
;
return
weight
>=
FC_WEIGHT_BOLD
;
}
static
bool
fontIsItalic
(
FcPattern
*
pattern
)
{
int
slant
=
0
;
if
(
FcPatternGetInteger
(
pattern
,
FC_SLANT
,
0
,
&
slant
)
!=
FcResultMatch
)
return
false
;
return
slant
!=
FC_SLANT_ROMAN
;
}
FontCache
::
PlatformFallbackFont
m_fallbackFont
;
// m_supportedCharaters is owned by the parent
// FcFontSet and should never be freed.
FcCharSet
*
m_supportedCharacters
;
};
class
CachedFontSet
{
WTF_MAKE_NONCOPYABLE
(
CachedFontSet
);
public:
// CachedFontSet takes ownership of the passed FcFontSet.
static
PassOwnPtr
<
CachedFontSet
>
createForLocale
(
const
char
*
locale
)
{
FcFontSet
*
fontSet
=
createFcFontSetForLocale
(
locale
);
return
adoptPtr
(
new
CachedFontSet
(
fontSet
));
}
~
CachedFontSet
()
{
m_fallbackList
.
clear
();
FcFontSetDestroy
(
m_fontSet
);
}
FontCache
::
PlatformFallbackFont
fallbackFontForChar
(
UChar32
c
)
{
Vector
<
CachedFont
>::
iterator
itr
=
m_fallbackList
.
begin
();
for
(;
itr
!=
m_fallbackList
.
end
();
itr
++
)
{
if
(
itr
->
hasGlyphForCharacter
(
c
))
return
itr
->
fallbackFont
();
}
// The previous code just returned garbage if the user didn't
// have the necessary fonts, this seems better than garbage.
// Current callers happen to ignore any values with an empty family string.
return
FontCache
::
PlatformFallbackFont
();
}
private:
static
FcFontSet
*
createFcFontSetForLocale
(
const
char
*
locale
)
{
FcPattern
*
pattern
=
FcPatternCreate
();
if
(
locale
)
{
// FcChar* is unsigned char* so we have to cast.
FcPatternAddString
(
pattern
,
FC_LANG
,
reinterpret_cast
<
const
FcChar8
*>
(
locale
));
}
FcValue
fcvalue
;
fcvalue
.
type
=
FcTypeBool
;
fcvalue
.
u
.
b
=
FcTrue
;
FcPatternAdd
(
pattern
,
FC_SCALABLE
,
fcvalue
,
FcFalse
);
FcConfigSubstitute
(
0
,
pattern
,
FcMatchPattern
);
FcDefaultSubstitute
(
pattern
);
if
(
!
locale
)
FcPatternDel
(
pattern
,
FC_LANG
);
// The result parameter returns if any fonts were found.
// We already handle 0 fonts correctly, so we ignore the param.
FcResult
result
;
FcFontSet
*
fontSet
=
FcFontSort
(
0
,
pattern
,
0
,
0
,
&
result
);
FcPatternDestroy
(
pattern
);
// The caller will take ownership of this FcFontSet.
return
fontSet
;
}
CachedFontSet
(
FcFontSet
*
fontSet
)
:
m_fontSet
(
fontSet
)
{
fillFallbackList
();
}
void
fillFallbackList
()
{
ASSERT
(
m_fallbackList
.
isEmpty
());
if
(
!
m_fontSet
)
return
;
for
(
int
i
=
0
;
i
<
m_fontSet
->
nfont
;
++
i
)
{
FcPattern
*
pattern
=
m_fontSet
->
fonts
[
i
];
// Ignore any bitmap fonts users may still have installed from last
// century.
FcBool
isScalable
;
if
(
FcPatternGetBool
(
pattern
,
FC_SCALABLE
,
0
,
&
isScalable
)
!=
FcResultMatch
||
!
isScalable
)
continue
;
// Ignore any fonts FontConfig knows about, but that we don't have
// permission to read.
FcChar8
*
cFilename
;
if
(
FcPatternGetString
(
pattern
,
FC_FILE
,
0
,
&
cFilename
)
!=
FcResultMatch
)
continue
;
if
(
access
(
reinterpret_cast
<
char
*>
(
cFilename
),
R_OK
))
continue
;
// Make sure this font can tell us what characters it has glyphs for.
FcCharSet
*
charSet
;
if
(
FcPatternGetCharSet
(
pattern
,
FC_CHARSET
,
0
,
&
charSet
)
!=
FcResultMatch
)
continue
;
m_fallbackList
.
append
(
CachedFont
(
pattern
,
charSet
));
}
}
FcFontSet
*
m_fontSet
;
// Owned by this object.
// CachedFont has a FcCharset* which points into the FcFontSet.
// If the FcFontSet is ever destroyed, the fallbackList
// must be cleared first.
Vector
<
CachedFont
>
m_fallbackList
;
};
class
FontSetCache
{
public:
static
FontSetCache
&
shared
()
{
DEFINE_STATIC_LOCAL
(
FontSetCache
,
cache
,
());
return
cache
;
}
FontCache
::
PlatformFallbackFont
fallbackFontForCharInLocale
(
UChar32
c
,
const
char
*
locale
)
{
DEFINE_STATIC_LOCAL
(
AtomicString
,
kNoLocale
,
(
"NO_LOCALE_SPECIFIED"
));
AtomicString
localeKey
;
if
(
locale
&&
strlen
(
locale
))
{
localeKey
=
AtomicString
(
locale
);
}
else
{
// String hash computation the m_setsByLocale map needs
// a non-empty string.
localeKey
=
kNoLocale
;
}
LocaleToCachedFont
::
iterator
itr
=
m_setsByLocale
.
find
(
localeKey
);
if
(
itr
==
m_setsByLocale
.
end
())
{
OwnPtr
<
CachedFontSet
>
newEntry
=
CachedFontSet
::
createForLocale
(
strlen
(
locale
)
?
locale
:
0
);
return
m_setsByLocale
.
add
(
localeKey
,
newEntry
.
release
())
.
storedValue
->
value
->
fallbackFontForChar
(
c
);
}
return
itr
.
get
()
->
value
->
fallbackFontForChar
(
c
);
}
// FIXME: We may wish to add a way to prune the cache at a later time.
private:
// FIXME: This shouldn't need to be AtomicString, but
// currently HashTraits<const char*> isn't smart enough
// to hash the string (only does pointer compares).
typedef
HashMap
<
AtomicString
,
OwnPtr
<
CachedFontSet
>>
LocaleToCachedFont
;
LocaleToCachedFont
m_setsByLocale
;
};
void
FontCache
::
getFontForCharacter
(
UChar32
c
,
const
char
*
locale
,
FontCache
::
PlatformFallbackFont
*
fallbackFont
)
{
*
fallbackFont
=
FontSetCache
::
shared
().
fallbackFontForCharInLocale
(
c
,
locale
);
}
}
// namespace blink
}
// namespace blink
sky/engine/platform/fonts/linux/FontPlatformDataLinux.cpp
浏览文件 @
35c66714
...
...
@@ -32,7 +32,6 @@
#include "flutter/sky/engine/platform/fonts/FontPlatformData.h"
#include "flutter/sky/engine/platform/graphics/GraphicsContext.h"
#include "flutter/sky/engine/public/platform/linux/WebFontRenderStyle.h"
#include "third_party/skia/include/core/SkTypeface.h"
namespace
blink
{
...
...
@@ -43,90 +42,87 @@ static bool useSkiaBitmaps = true;
static
bool
useSkiaAntiAlias
=
true
;
static
bool
useSkiaSubpixelRendering
=
false
;
void
FontPlatformData
::
setHinting
(
SkPaint
::
Hinting
hinting
)
{
skiaHinting
=
hinting
;
void
FontPlatformData
::
setHinting
(
SkPaint
::
Hinting
hinting
)
{
skiaHinting
=
hinting
;
}
void
FontPlatformData
::
setAutoHint
(
bool
useAutoHint
)
{
useSkiaAutoHint
=
useAutoHint
;
void
FontPlatformData
::
setAutoHint
(
bool
useAutoHint
)
{
useSkiaAutoHint
=
useAutoHint
;
}
void
FontPlatformData
::
setUseBitmaps
(
bool
useBitmaps
)
{
useSkiaBitmaps
=
useBitmaps
;
void
FontPlatformData
::
setUseBitmaps
(
bool
useBitmaps
)
{
useSkiaBitmaps
=
useBitmaps
;
}
void
FontPlatformData
::
setAntiAlias
(
bool
useAntiAlias
)
{
useSkiaAntiAlias
=
useAntiAlias
;
void
FontPlatformData
::
setAntiAlias
(
bool
useAntiAlias
)
{
useSkiaAntiAlias
=
useAntiAlias
;
}
void
FontPlatformData
::
setSubpixelRendering
(
bool
useSubpixelRendering
)
{
useSkiaSubpixelRendering
=
useSubpixelRendering
;
void
FontPlatformData
::
setSubpixelRendering
(
bool
useSubpixelRendering
)
{
useSkiaSubpixelRendering
=
useSubpixelRendering
;
}
void
FontPlatformData
::
setupPaint
(
SkPaint
*
paint
,
GraphicsContext
*
context
)
const
{
paint
->
setAntiAlias
(
m_style
.
useAntiAlias
);
paint
->
setHinting
(
static_cast
<
SkPaint
::
Hinting
>
(
m_style
.
hintStyle
));
paint
->
setEmbeddedBitmapText
(
m_style
.
useBitmaps
);
paint
->
setAutohinted
(
m_style
.
useAutoHint
);
if
(
m_style
.
useAntiAlias
)
paint
->
setLCDRenderText
(
m_style
.
useSubpixelRendering
);
// Do not enable subpixel text on low-dpi if full hinting is requested.
bool
useSubpixelText
=
paint
->
getHinting
()
!=
SkPaint
::
kFull_Hinting
||
(
context
&&
context
->
deviceScaleFactor
()
>
1.0
f
);
// TestRunner specifically toggles the subpixel positioning flag.
if
(
useSubpixelText
)
paint
->
setSubpixelText
(
true
);
else
paint
->
setSubpixelText
(
m_style
.
useSubpixelPositioning
);
const
float
ts
=
m_textSize
>=
0
?
m_textSize
:
12
;
paint
->
setTextSize
(
SkFloatToScalar
(
ts
));
paint
->
setTypeface
(
m_typeface
);
paint
->
setFakeBoldText
(
m_syntheticBold
);
paint
->
setTextSkewX
(
m_syntheticItalic
?
-
SK_Scalar1
/
4
:
0
);
void
FontPlatformData
::
setupPaint
(
SkPaint
*
paint
,
GraphicsContext
*
context
)
const
{
paint
->
setAntiAlias
(
m_style
.
useAntiAlias
);
paint
->
setHinting
(
static_cast
<
SkPaint
::
Hinting
>
(
m_style
.
hintStyle
));
paint
->
setEmbeddedBitmapText
(
m_style
.
useBitmaps
);
paint
->
setAutohinted
(
m_style
.
useAutoHint
);
if
(
m_style
.
useAntiAlias
)
paint
->
setLCDRenderText
(
m_style
.
useSubpixelRendering
);
// Do not enable subpixel text on low-dpi if full hinting is requested.
bool
useSubpixelText
=
paint
->
getHinting
()
!=
SkPaint
::
kFull_Hinting
||
(
context
&&
context
->
deviceScaleFactor
()
>
1.0
f
);
// TestRunner specifically toggles the subpixel positioning flag.
if
(
useSubpixelText
)
paint
->
setSubpixelText
(
true
);
else
paint
->
setSubpixelText
(
m_style
.
useSubpixelPositioning
);
const
float
ts
=
m_textSize
>=
0
?
m_textSize
:
12
;
paint
->
setTextSize
(
SkFloatToScalar
(
ts
));
paint
->
setTypeface
(
m_typeface
);
paint
->
setFakeBoldText
(
m_syntheticBold
);
paint
->
setTextSkewX
(
m_syntheticItalic
?
-
SK_Scalar1
/
4
:
0
);
}
void
FontPlatformData
::
querySystemForRenderStyle
(
bool
useSkiaSubpixelPositioning
)
{
WebFontRenderStyle
style
;
style
.
setDefaults
();
style
.
toFontRenderStyle
(
&
m_style
);
// Fix FontRenderStyle::NoPreference to actual styles.
if
(
m_style
.
useAntiAlias
==
FontRenderStyle
::
NoPreference
)
m_style
.
useAntiAlias
=
useSkiaAntiAlias
;
if
(
!
m_style
.
useHinting
)
m_style
.
hintStyle
=
SkPaint
::
kNo_Hinting
;
else
if
(
m_style
.
useHinting
==
FontRenderStyle
::
NoPreference
)
m_style
.
hintStyle
=
skiaHinting
;
if
(
m_style
.
useBitmaps
==
FontRenderStyle
::
NoPreference
)
m_style
.
useBitmaps
=
useSkiaBitmaps
;
if
(
m_style
.
useAutoHint
==
FontRenderStyle
::
NoPreference
)
m_style
.
useAutoHint
=
useSkiaAutoHint
;
if
(
m_style
.
useAntiAlias
==
FontRenderStyle
::
NoPreference
)
m_style
.
useAntiAlias
=
useSkiaAntiAlias
;
if
(
m_style
.
useSubpixelRendering
==
FontRenderStyle
::
NoPreference
)
m_style
.
useSubpixelRendering
=
useSkiaSubpixelRendering
;
// TestRunner specifically toggles the subpixel positioning flag.
if
(
m_style
.
useSubpixelPositioning
==
FontRenderStyle
::
NoPreference
)
m_style
.
useSubpixelPositioning
=
useSkiaSubpixelPositioning
;
void
FontPlatformData
::
querySystemForRenderStyle
(
bool
useSkiaSubpixelPositioning
)
{
m_style
.
useBitmaps
=
2
;
m_style
.
useAutoHint
=
2
;
m_style
.
useHinting
=
2
;
m_style
.
hintStyle
=
0
;
m_style
.
useAntiAlias
=
2
;
m_style
.
useSubpixelRendering
=
2
;
m_style
.
useSubpixelPositioning
=
2
;
// Fix FontRenderStyle::NoPreference to actual styles.
if
(
m_style
.
useAntiAlias
==
FontRenderStyle
::
NoPreference
)
m_style
.
useAntiAlias
=
useSkiaAntiAlias
;
if
(
!
m_style
.
useHinting
)
m_style
.
hintStyle
=
SkPaint
::
kNo_Hinting
;
else
if
(
m_style
.
useHinting
==
FontRenderStyle
::
NoPreference
)
m_style
.
hintStyle
=
skiaHinting
;
if
(
m_style
.
useBitmaps
==
FontRenderStyle
::
NoPreference
)
m_style
.
useBitmaps
=
useSkiaBitmaps
;
if
(
m_style
.
useAutoHint
==
FontRenderStyle
::
NoPreference
)
m_style
.
useAutoHint
=
useSkiaAutoHint
;
if
(
m_style
.
useAntiAlias
==
FontRenderStyle
::
NoPreference
)
m_style
.
useAntiAlias
=
useSkiaAntiAlias
;
if
(
m_style
.
useSubpixelRendering
==
FontRenderStyle
::
NoPreference
)
m_style
.
useSubpixelRendering
=
useSkiaSubpixelRendering
;
// TestRunner specifically toggles the subpixel positioning flag.
if
(
m_style
.
useSubpixelPositioning
==
FontRenderStyle
::
NoPreference
)
m_style
.
useSubpixelPositioning
=
useSkiaSubpixelPositioning
;
}
bool
FontPlatformData
::
defaultUseSubpixelPositioning
()
{
return
FontDescription
::
subpixelPositioning
();
bool
FontPlatformData
::
defaultUseSubpixelPositioning
()
{
return
FontDescription
::
subpixelPositioning
();
}
}
// namespace blink
}
// namespace blink
sky/engine/public/BUILD.gn
浏览文件 @
35c66714
...
...
@@ -14,14 +14,8 @@ source_set("platform_headers") {
public = [
"platform/Platform.h",
"platform/WebBlendMode.h",
"platform/WebCString.h",
"platform/WebCommon.h",
"platform/WebDiscardableMemory.h",
"platform/WebPrivatePtr.h",
"platform/WebVector.h",
"platform/linux/WebFallbackFont.h",
"platform/linux/WebFontInfo.h",
"platform/linux/WebFontRenderStyle.h",
]
}
...
...
sky/engine/public/platform/Platform.h
浏览文件 @
35c66714
...
...
@@ -34,7 +34,6 @@
#include <string>
#include "flutter/sky/engine/public/platform/WebCommon.h"
#include "flutter/sky/engine/public/platform/WebVector.h"
namespace
ftl
{
class
TaskRunner
;
...
...
sky/engine/public/platform/WebCString.h
已删除
100644 → 0
浏览文件 @
c6f67824
/*
* Copyright (C) 2009 Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following disclaimer
* in the documentation and/or other materials provided with the
* distribution.
* * Neither the name of Google Inc. nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef SKY_ENGINE_PUBLIC_PLATFORM_WEBCSTRING_H_
#define SKY_ENGINE_PUBLIC_PLATFORM_WEBCSTRING_H_
#include "flutter/sky/engine/public/platform/WebCommon.h"
#include "flutter/sky/engine/public/platform/WebPrivatePtr.h"
#if INSIDE_BLINK
#include "flutter/sky/engine/wtf/Forward.h"
#endif
#if !INSIDE_BLINK || defined(UNIT_TEST)
#include <string>
#endif
namespace
WTF
{
class
CString
;
class
CStringBuffer
;
}
namespace
blink
{
// A single-byte string container with unspecified encoding. It is
// inexpensive to copy a WebCString object.
//
// WARNING: It is not safe to pass a WebCString across threads!!!
//
class
WebCString
{
public:
~
WebCString
()
{
reset
();
}
WebCString
()
{
}
WebCString
(
const
char
*
data
,
size_t
len
)
{
assign
(
data
,
len
);
}
WebCString
(
const
WebCString
&
s
)
{
assign
(
s
);
}
WebCString
&
operator
=
(
const
WebCString
&
s
)
{
assign
(
s
);
return
*
this
;
}
// Returns 0 if both strings are equals, a value greater than zero if the
// first character that does not match has a greater value in this string
// than in |other|, or a value less than zero to indicate the opposite.
BLINK_COMMON_EXPORT
int
compare
(
const
WebCString
&
other
)
const
;
BLINK_COMMON_EXPORT
void
reset
();
BLINK_COMMON_EXPORT
void
assign
(
const
WebCString
&
);
BLINK_COMMON_EXPORT
void
assign
(
const
char
*
data
,
size_t
len
);
BLINK_COMMON_EXPORT
size_t
length
()
const
;
BLINK_COMMON_EXPORT
const
char
*
data
()
const
;
bool
isEmpty
()
const
{
return
!
length
();
}
bool
isNull
()
const
{
return
m_private
.
isNull
();
}
#if INSIDE_BLINK
BLINK_COMMON_EXPORT
WebCString
(
const
WTF
::
CString
&
);
BLINK_COMMON_EXPORT
WebCString
&
operator
=
(
const
WTF
::
CString
&
);
BLINK_COMMON_EXPORT
operator
WTF
::
CString
()
const
;
#else
WebCString
(
const
std
::
string
&
s
)
{
assign
(
s
.
data
(),
s
.
length
());
}
WebCString
&
operator
=
(
const
std
::
string
&
s
)
{
assign
(
s
.
data
(),
s
.
length
());
return
*
this
;
}
#endif
#if !INSIDE_BLINK || defined(UNIT_TEST)
operator
std
::
string
()
const
{
size_t
len
=
length
();
return
len
?
std
::
string
(
data
(),
len
)
:
std
::
string
();
}
template
<
class
UTF16String
>
static
WebCString
fromUTF16
(
const
UTF16String
&
s
)
{
return
fromUTF16
(
s
.
data
(),
s
.
length
());
}
#endif
private:
BLINK_COMMON_EXPORT
void
assign
(
WTF
::
CStringBuffer
*
);
WebPrivatePtr
<
WTF
::
CStringBuffer
>
m_private
;
};
inline
bool
operator
<
(
const
WebCString
&
a
,
const
WebCString
&
b
)
{
return
a
.
compare
(
b
)
<
0
;
}
}
// namespace blink
#endif // SKY_ENGINE_PUBLIC_PLATFORM_WEBCSTRING_H_
sky/engine/public/platform/WebNonCopyable.h
已删除
100644 → 0
浏览文件 @
c6f67824
/*
* Copyright (C) 2009 Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following disclaimer
* in the documentation and/or other materials provided with the
* distribution.
* * Neither the name of Google Inc. nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef SKY_ENGINE_PUBLIC_PLATFORM_WEBNONCOPYABLE_H_
#define SKY_ENGINE_PUBLIC_PLATFORM_WEBNONCOPYABLE_H_
namespace
blink
{
// A base class to extend from if you do not support copying.
class
WebNonCopyable
{
protected:
WebNonCopyable
()
{
}
~
WebNonCopyable
()
{
}
private:
WebNonCopyable
(
const
WebNonCopyable
&
);
WebNonCopyable
&
operator
=
(
const
WebNonCopyable
&
);
};
}
// namespace blink
#endif // SKY_ENGINE_PUBLIC_PLATFORM_WEBNONCOPYABLE_H_
sky/engine/public/platform/WebPrivatePtr.h
已删除
100644 → 0
浏览文件 @
c6f67824
/*
* Copyright (C) 2010 Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following disclaimer
* in the documentation and/or other materials provided with the
* distribution.
* * Neither the name of Google Inc. nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef SKY_ENGINE_PUBLIC_PLATFORM_WEBPRIVATEPTR_H_
#define SKY_ENGINE_PUBLIC_PLATFORM_WEBPRIVATEPTR_H_
#include "flutter/sky/engine/public/platform/WebCommon.h"
#if INSIDE_BLINK
#include "flutter/sky/engine/platform/heap/Handle.h"
#include "flutter/sky/engine/wtf/PassRefPtr.h"
#include "flutter/sky/engine/wtf/TypeTraits.h"
#endif
namespace
blink
{
#if INSIDE_BLINK
template
<
typename
T
>
class
PtrStorageImpl
{
public:
typedef
PassRefPtr
<
T
>
BlinkPtrType
;
void
assign
(
const
BlinkPtrType
&
val
)
{
release
();
m_ptr
=
val
.
leakRef
();
}
void
assign
(
const
PtrStorageImpl
&
other
)
{
release
();
T
*
val
=
other
.
get
();
WTF
::
refIfNotNull
(
val
);
m_ptr
=
val
;
}
T
*
get
()
const
{
return
m_ptr
;
}
void
release
()
{
WTF
::
derefIfNotNull
(
m_ptr
);
m_ptr
=
0
;
}
private:
T
*
m_ptr
;
};
template
<
typename
T
>
class
PtrStorage
:
public
PtrStorageImpl
<
T
>
{
public:
static
PtrStorage
&
fromSlot
(
void
**
slot
)
{
COMPILE_ASSERT
(
sizeof
(
PtrStorage
)
==
sizeof
(
void
*
),
PtrStorage_must_be_pointer_size
);
return
*
reinterpret_cast
<
PtrStorage
*>
(
slot
);
}
static
const
PtrStorage
&
fromSlot
(
void
*
const
*
slot
)
{
COMPILE_ASSERT
(
sizeof
(
PtrStorage
)
==
sizeof
(
void
*
),
PtrStorage_must_be_pointer_size
);
return
*
reinterpret_cast
<
const
PtrStorage
*>
(
slot
);
}
private:
// Prevent construction via normal means.
PtrStorage
();
PtrStorage
(
const
PtrStorage
&
);
};
#endif
// This class is an implementation detail of the Blink API. It exists to help
// simplify the implementation of Blink interfaces that merely wrap a reference
// counted WebCore class.
//
// A typical implementation of a class which uses WebPrivatePtr might look like
// this:
// class WebFoo {
// public:
// BLINK_EXPORT ~WebFoo();
// WebFoo() { }
// WebFoo(const WebFoo& other) { assign(other); }
// WebFoo& operator=(const WebFoo& other)
// {
// assign(other);
// return *this;
// }
// BLINK_EXPORT void assign(const WebFoo&); // Implemented in the body.
//
// // Methods that are exposed to Chromium and which are specific to
// // WebFoo go here.
// BLINK_EXPORT doWebFooThing();
//
// // Methods that are used only by other Blink classes should only be
// // declared when INSIDE_BLINK is set.
// #if INSIDE_BLINK
// WebFoo(const WTF::PassRefPtr<Foo>&);
// #endif
//
// private:
// WebPrivatePtr<Foo> m_private;
// };
//
// // WebFoo.cpp
// WebFoo::~WebFoo() { m_private.reset(); }
// void WebFoo::assign(const WebFoo& other) { ... }
//
template
<
typename
T
>
class
WebPrivatePtr
{
public:
WebPrivatePtr
()
:
m_storage
(
0
)
{
}
~
WebPrivatePtr
()
{
// We don't destruct the object pointed by m_ptr here because we don't
// want to expose destructors of core classes to embedders. We should
// call reset() manually in destructors of classes with WebPrivatePtr
// members.
BLINK_ASSERT
(
!
m_storage
);
}
bool
isNull
()
const
{
return
!
m_storage
;
}
#if INSIDE_BLINK
template
<
typename
U
>
WebPrivatePtr
(
const
U
&
ptr
)
:
m_storage
(
0
)
{
storage
().
assign
(
ptr
);
}
void
reset
()
{
storage
().
release
();
}
WebPrivatePtr
<
T
>&
operator
=
(
const
WebPrivatePtr
<
T
>&
other
)
{
storage
().
assign
(
other
.
storage
());
return
*
this
;
}
template
<
typename
U
>
WebPrivatePtr
<
T
>&
operator
=
(
const
U
&
ptr
)
{
storage
().
assign
(
ptr
);
return
*
this
;
}
T
*
get
()
const
{
return
storage
().
get
();
}
T
&
operator
*
()
const
{
ASSERT
(
m_storage
);
return
*
get
();
}
T
*
operator
->
()
const
{
ASSERT
(
m_storage
);
return
get
();
}
#endif
private:
#if INSIDE_BLINK
PtrStorage
<
T
>&
storage
()
{
return
PtrStorage
<
T
>::
fromSlot
(
&
m_storage
);
}
const
PtrStorage
<
T
>&
storage
()
const
{
return
PtrStorage
<
T
>::
fromSlot
(
&
m_storage
);
}
#endif
#if !INSIDE_BLINK
// Disable the assignment operator; we define it above for when
// INSIDE_BLINK is set, but we need to make sure that it is not
// used outside there; the compiler-provided version won't handle reference
// counting properly.
WebPrivatePtr
<
T
>&
operator
=
(
const
WebPrivatePtr
<
T
>&
other
);
#endif
// Disable the copy constructor; classes that contain a WebPrivatePtr
// should implement their copy constructor using assign().
WebPrivatePtr
(
const
WebPrivatePtr
<
T
>&
);
void
*
m_storage
;
};
}
// namespace blink
#endif // SKY_ENGINE_PUBLIC_PLATFORM_WEBPRIVATEPTR_H_
sky/engine/public/platform/WebVector.h
已删除
100644 → 0
浏览文件 @
c6f67824
/*
* Copyright (C) 2009 Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following disclaimer
* in the documentation and/or other materials provided with the
* distribution.
* * Neither the name of Google Inc. nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef SKY_ENGINE_PUBLIC_PLATFORM_WEBVECTOR_H_
#define SKY_ENGINE_PUBLIC_PLATFORM_WEBVECTOR_H_
#include <stdlib.h>
#include <algorithm>
#include <limits>
#include "flutter/sky/engine/public/platform/WebCommon.h"
namespace
blink
{
// A simple vector class.
//
// Sample usage:
//
// void Foo(WebVector<int>& result)
// {
// WebVector<int> data(10);
// for (size_t i = 0; i < data.size(); ++i)
// data[i] = ...
// result.swap(data);
// }
//
// It is also possible to assign from other types of random access
// containers:
//
// void Foo(const std::vector<std::string>& input)
// {
// WebVector<WebCString> cstrings = input;
// ...
// }
//
template
<
typename
T
>
class
WebVector
{
public:
typedef
T
ValueType
;
~
WebVector
()
{
destroy
();
}
explicit
WebVector
(
size_t
size
=
0
)
{
initialize
(
size
);
}
template
<
typename
U
>
WebVector
(
const
U
*
values
,
size_t
size
)
{
initializeFrom
(
values
,
size
);
}
WebVector
(
const
WebVector
<
T
>&
other
)
{
initializeFrom
(
other
.
m_ptr
,
other
.
m_size
);
}
template
<
typename
C
>
WebVector
(
const
C
&
other
)
{
initializeFrom
(
other
.
size
()
?
&
other
[
0
]
:
0
,
other
.
size
());
}
WebVector
&
operator
=
(
const
WebVector
&
other
)
{
if
(
this
!=
&
other
)
assign
(
other
);
return
*
this
;
}
template
<
typename
C
>
WebVector
<
T
>&
operator
=
(
const
C
&
other
)
{
if
(
this
!=
reinterpret_cast
<
const
WebVector
<
T
>*>
(
&
other
))
assign
(
other
);
return
*
this
;
}
template
<
typename
C
>
void
assign
(
const
C
&
other
)
{
assign
(
other
.
size
()
?
&
other
[
0
]
:
0
,
other
.
size
());
}
template
<
typename
U
>
void
assign
(
const
U
*
values
,
size_t
size
)
{
destroy
();
initializeFrom
(
values
,
size
);
}
size_t
size
()
const
{
return
m_size
;
}
bool
isEmpty
()
const
{
return
!
m_size
;
}
T
&
operator
[](
size_t
i
)
{
BLINK_ASSERT
(
i
<
m_size
);
return
m_ptr
[
i
];
}
const
T
&
operator
[](
size_t
i
)
const
{
BLINK_ASSERT
(
i
<
m_size
);
return
m_ptr
[
i
];
}
bool
contains
(
const
T
&
value
)
const
{
for
(
size_t
i
=
0
;
i
<
m_size
;
i
++
)
{
if
(
m_ptr
[
i
]
==
value
)
return
true
;
}
return
false
;
}
T
*
data
()
{
return
m_ptr
;
}
const
T
*
data
()
const
{
return
m_ptr
;
}
void
swap
(
WebVector
<
T
>&
other
)
{
std
::
swap
(
m_ptr
,
other
.
m_ptr
);
std
::
swap
(
m_size
,
other
.
m_size
);
}
private:
void
initialize
(
size_t
size
)
{
validateSize
(
size
);
m_size
=
size
;
if
(
!
m_size
)
m_ptr
=
0
;
else
{
m_ptr
=
static_cast
<
T
*>
(
::
operator
new
(
sizeof
(
T
)
*
m_size
));
for
(
size_t
i
=
0
;
i
<
m_size
;
++
i
)
new
(
&
m_ptr
[
i
])
T
();
}
}
template
<
typename
U
>
void
initializeFrom
(
const
U
*
values
,
size_t
size
)
{
validateSize
(
size
);
m_size
=
size
;
if
(
!
m_size
)
m_ptr
=
0
;
else
{
m_ptr
=
static_cast
<
T
*>
(
::
operator
new
(
sizeof
(
T
)
*
m_size
));
for
(
size_t
i
=
0
;
i
<
m_size
;
++
i
)
new
(
&
m_ptr
[
i
])
T
(
values
[
i
]);
}
}
void
validateSize
(
size_t
size
)
{
if
(
std
::
numeric_limits
<
size_t
>::
max
()
/
sizeof
(
T
)
<
size
)
abort
();
}
void
destroy
()
{
for
(
size_t
i
=
0
;
i
<
m_size
;
++
i
)
m_ptr
[
i
].
~
T
();
::
operator
delete
(
m_ptr
);
}
T
*
m_ptr
;
size_t
m_size
;
};
}
// namespace blink
#endif // SKY_ENGINE_PUBLIC_PLATFORM_WEBVECTOR_H_
sky/engine/public/platform/linux/WebFallbackFont.h
已删除
100644 → 0
浏览文件 @
c6f67824
/*
* Copyright (C) 2011 Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following disclaimer
* in the documentation and/or other materials provided with the
* distribution.
* * Neither the name of Google Inc. nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef SKY_ENGINE_PUBLIC_PLATFORM_LINUX_WEBFALLBACKFONT_H_
#define SKY_ENGINE_PUBLIC_PLATFORM_LINUX_WEBFALLBACKFONT_H_
#include "../WebCString.h"
#include "../WebCommon.h"
namespace
blink
{
struct
WebFallbackFont
{
WebFallbackFont
()
:
name
(
WebCString
())
,
filename
(
WebCString
())
,
fontconfigInterfaceId
(
0
)
,
ttcIndex
(
0
)
,
isBold
(
false
)
,
isItalic
(
false
)
{
};
WebCString
name
;
WebCString
filename
;
int
fontconfigInterfaceId
;
int
ttcIndex
;
bool
isBold
;
bool
isItalic
;
};
}
// namespace blink
#endif // SKY_ENGINE_PUBLIC_PLATFORM_LINUX_WEBFALLBACKFONT_H_
sky/engine/public/platform/linux/WebFontInfo.h
已删除
100644 → 0
浏览文件 @
c6f67824
/*
* Copyright (C) 2009 Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following disclaimer
* in the documentation and/or other materials provided with the
* distribution.
* * Neither the name of Google Inc. nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef SKY_ENGINE_PUBLIC_PLATFORM_LINUX_WEBFONTINFO_H_
#define SKY_ENGINE_PUBLIC_PLATFORM_LINUX_WEBFONTINFO_H_
#include <string.h>
#include <unistd.h>
#include "flutter/sky/engine/public/platform/WebCString.h"
#include "flutter/sky/engine/public/platform/linux/WebFallbackFont.h"
namespace
blink
{
class
WebFontInfo
{
public:
// Return a font family which provides a glyph for the Unicode code point
// specified by character.
// character: a UTF-32 code point
// preferredLocale: preferred locale identifier for the |characters|
// (e.g. "en", "ja", "zh-CN")
//
// Returns: the font family or an empty string if the request could not be satisfied.
// Returns: the font family instance. The instance has an empty font name if the request could not be satisfied.
BLINK_EXPORT
static
void
fallbackFontForChar
(
const
WebUChar32
character
,
const
char
*
preferredLocale
,
WebFallbackFont
*
);
};
}
// namespace blink
#endif // SKY_ENGINE_PUBLIC_PLATFORM_LINUX_WEBFONTINFO_H_
sky/engine/public/platform/linux/WebFontRenderStyle.h
已删除
100644 → 0
浏览文件 @
c6f67824
/*
* Copyright (C) 2010 Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following disclaimer
* in the documentation and/or other materials provided with the
* distribution.
* * Neither the name of Google Inc. nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef SKY_ENGINE_PUBLIC_PLATFORM_LINUX_WEBFONTRENDERSTYLE_H_
#define SKY_ENGINE_PUBLIC_PLATFORM_LINUX_WEBFONTRENDERSTYLE_H_
#include "../WebCommon.h"
namespace
blink
{
struct
FontRenderStyle
;
struct
BLINK_EXPORT
WebFontRenderStyle
{
// Each of the use* members below can take one of three values:
// 0: off
// 1: on
// 2: no preference expressed
char
useBitmaps
;
// use embedded bitmap strike if possible
char
useAutoHint
;
// use 'auto' hinting (FreeType specific)
char
useHinting
;
// hint glyphs to the pixel grid
char
hintStyle
;
// level of hinting, 0..3
char
useAntiAlias
;
// antialias glyph shapes
char
useSubpixelRendering
;
// use subpixel rendering (partially-filled pixels)
char
useSubpixelPositioning
;
// use subpixel positioning (fractional X positions for glyphs)
#if BLINK_IMPLEMENTATION || BLINK_PLATFORM_IMPLEMENTATION
// Translates the members of this struct to a FontRenderStyle
void
toFontRenderStyle
(
FontRenderStyle
*
);
#endif
void
setDefaults
();
};
}
// namespace blink
#endif // SKY_ENGINE_PUBLIC_PLATFORM_LINUX_WEBFONTRENDERSTYLE_H_
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录