diff options
author | agl@chromium.org <agl@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-07-14 21:15:01 +0000 |
---|---|---|
committer | agl@chromium.org <agl@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-07-14 21:15:01 +0000 |
commit | 5a562ec1e1b621aa6e696b795f83a890f2684b84 (patch) | |
tree | bd2b133db8bd16f05bd8dfb273f8c0ff721b86ce /webkit | |
parent | 48676d6ed4d082f8ce16442df6103786e9c51fb9 (diff) | |
download | chromium_src-5a562ec1e1b621aa6e696b795f83a890f2684b84.zip chromium_src-5a562ec1e1b621aa6e696b795f83a890f2684b84.tar.gz chromium_src-5a562ec1e1b621aa6e696b795f83a890f2684b84.tar.bz2 |
Linux: filter out unreadable fonts
Fontconfig will return fonts which are unreadable to the current
process if the system cache contains them.
BUG=16715
http://codereview.chromium.org/149628
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@20663 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit')
-rw-r--r-- | webkit/api/public/gtk/WebFontInfo.h | 3 | ||||
-rw-r--r-- | webkit/api/src/gtk/WebFontInfo.cpp | 8 |
2 files changed, 11 insertions, 0 deletions
diff --git a/webkit/api/public/gtk/WebFontInfo.h b/webkit/api/public/gtk/WebFontInfo.h index d77ce68..b5543c2 100644 --- a/webkit/api/public/gtk/WebFontInfo.h +++ b/webkit/api/public/gtk/WebFontInfo.h @@ -33,6 +33,9 @@ #include "../WebString.h" +#include <string.h> +#include <unistd.h> + namespace WebKit { class WebFontInfo { diff --git a/webkit/api/src/gtk/WebFontInfo.cpp b/webkit/api/src/gtk/WebFontInfo.cpp index 60fdde4..059ad4b 100644 --- a/webkit/api/src/gtk/WebFontInfo.cpp +++ b/webkit/api/src/gtk/WebFontInfo.cpp @@ -83,6 +83,14 @@ WebString WebFontInfo::familyForChars(const WebUChar* characters, size_t numChar || !isScalable) continue; + // fontconfig can also return fonts which are unreadable + FcChar8* cFilename; + if (FcPatternGetString(current, FC_FILE, 0, &cFilename) != FcResultMatch) + continue; + + if (access(reinterpret_cast<char*>(cFilename), R_OK) != 0) + continue; + FcChar8* family; WebString result; if (FcPatternGetString(current, FC_FAMILY, 0, &family) == FcResultMatch) { |