summaryrefslogtreecommitdiffstats
path: root/base
diff options
context:
space:
mode:
authorasvitkine@chromium.org <asvitkine@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-02-28 18:14:49 +0000
committerasvitkine@chromium.org <asvitkine@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-02-28 18:14:49 +0000
commitcb0264c4a8443578418de54ac7278fdb9efcbe3d (patch)
tree69062d0fda021d25de3bad9f2175c92041a7af24 /base
parent1adf1eb2d340b970b1713935a8c936de1b2e2a4d (diff)
downloadchromium_src-cb0264c4a8443578418de54ac7278fdb9efcbe3d.zip
chromium_src-cb0264c4a8443578418de54ac7278fdb9efcbe3d.tar.gz
chromium_src-cb0264c4a8443578418de54ac7278fdb9efcbe3d.tar.bz2
Implement font linking for RenderTextWin.
Font linking is needed for East Asian fonts where Windows font fallback doesn't work. This change adds support for font linking by making RenderTextWin read and cache the font link lists from the registry and use these when there are missing glyphs returned from ScriptShape(). BUG=90426, 105550 TEST=Build Chrome on Windows with use_canvas_skia_skia=1. Go to http://www.google.co.jp/shopping?hl=ja. The tab title should correctly display Japanese characters and not boxes. Review URL: https://chromiumcodereview.appspot.com/9429061 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@123998 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base')
-rw-r--r--base/win/registry.cc35
-rw-r--r--base/win/registry.h9
2 files changed, 42 insertions, 2 deletions
diff --git a/base/win/registry.cc b/base/win/registry.cc
index 25499d3..c96f804 100644
--- a/base/win/registry.cc
+++ b/base/win/registry.cc
@@ -1,10 +1,11 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 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/win/registry.h"
#include <shlwapi.h>
+#include <algorithm>
#include "base/logging.h"
#include "base/threading/thread_restrictions.h"
@@ -216,6 +217,38 @@ LONG RegKey::ReadValue(const wchar_t* name,
return result;
}
+LONG RegKey::ReadValues(const wchar_t* name,
+ std::vector<std::wstring>* values) {
+ base::ThreadRestrictions::AssertIOAllowed();
+ values->clear();
+
+ DWORD type = REG_MULTI_SZ;
+ DWORD size = 0;
+ LONG result = ReadValue(name, NULL, &size, NULL);
+ if (FAILED(result) || size == 0)
+ return result;
+
+ if (type != REG_MULTI_SZ)
+ return ERROR_CANTREAD;
+
+ std::vector<wchar_t> buffer(size / sizeof(wchar_t));
+ result = ReadValue(name, &buffer[0], &size, NULL);
+ if (FAILED(result) || size == 0)
+ return result;
+
+ // Parse the double-null-terminated list of strings.
+ // Note: This code is paranoid to not read outside of |buf|, in the case where
+ // it may not be properly terminated.
+ const wchar_t* entry = &buffer[0];
+ const wchar_t* buffer_end = entry + (size / sizeof(wchar_t));
+ while (entry < buffer_end && entry[0] != '\0') {
+ const wchar_t* entry_end = std::find(entry, buffer_end, L'\0');
+ values->push_back(std::wstring(entry, entry_end));
+ entry = entry_end + 1;
+ }
+ return 0;
+}
+
LONG RegKey::WriteValue(const wchar_t* name, DWORD in_value) {
return WriteValue(
name, &in_value, static_cast<DWORD>(sizeof(in_value)), REG_DWORD);
diff --git a/base/win/registry.h b/base/win/registry.h
index 9bc1576..abdf17a3 100644
--- a/base/win/registry.h
+++ b/base/win/registry.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 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.
@@ -8,6 +8,7 @@
#include <windows.h>
#include <string>
+#include <vector>
#include "base/base_export.h"
#include "base/basictypes.h"
@@ -80,6 +81,12 @@ class BASE_EXPORT RegKey {
// value, if any.
LONG ReadValue(const wchar_t* name, std::wstring* out_value) const;
+ // Reads a REG_MULTI_SZ registry field into a vector of strings. Clears
+ // |values| initially and adds further strings to the list. Returns
+ // ERROR_CANTREAD if type is not REG_MULTI_SZ.
+ LONG RegKey::ReadValues(const wchar_t* name,
+ std::vector<std::wstring>* values);
+
// Returns raw data. If |name| is NULL or empty, returns the default
// value, if any.
LONG ReadValue(const wchar_t* name,