diff options
author | asvitkine@chromium.org <asvitkine@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-02-28 18:14:49 +0000 |
---|---|---|
committer | asvitkine@chromium.org <asvitkine@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-02-28 18:14:49 +0000 |
commit | cb0264c4a8443578418de54ac7278fdb9efcbe3d (patch) | |
tree | 69062d0fda021d25de3bad9f2175c92041a7af24 /base/win/registry.cc | |
parent | 1adf1eb2d340b970b1713935a8c936de1b2e2a4d (diff) | |
download | chromium_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/win/registry.cc')
-rw-r--r-- | base/win/registry.cc | 35 |
1 files changed, 34 insertions, 1 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); |