Re-subimission of https://codereview.chromium.org/1041213003/
[chromium-blink-merge.git] / content / public / common / dwrite_font_platform_win.h
blob4c988bc82eb20acc970f6eba10bcd2547fc4f7e0
1 // Copyright 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.
5 #ifndef CONTENT_PUBLIC_COMMON_DWRITE_FONT_PLATFORM_WIN_H_
6 #define CONTENT_PUBLIC_COMMON_DWRITE_FONT_PLATFORM_WIN_H_
8 #include "base/files/file.h"
9 #include "content/common/content_export.h"
11 struct IDWriteFactory;
12 struct IDWriteFontCollection;
14 namespace content {
16 // This is the shared section that is used between browser and renderer for
17 // loading font cache. Section name is suffixed with browser process id so that
18 // multiple instance chrome scenario works fine.
19 CONTENT_EXPORT extern const char kFontCacheSharedSectionName[];
21 // Function returns custom font collection in terms of IDWriteFontCollection.
22 // This function maintains singleton instance of font collection and returns
23 // it on repeated calls.
24 CONTENT_EXPORT IDWriteFontCollection* GetCustomFontCollection(
25 IDWriteFactory* factory);
27 // Builds static font cache. As this function need to iterate through all
28 // available fonts in the system, it may take a while.
29 CONTENT_EXPORT bool BuildFontCache(const base::FilePath& file);
31 // Loads font cache from file. This is supposed to be used from browser
32 // side where loading means creating readonly shared memory file mapping so that
33 // renderers can read from it.
34 CONTENT_EXPORT bool LoadFontCache(const base::FilePath& path);
36 // Added in header mainly for unittest
37 CONTENT_EXPORT bool ValidateFontCacheFile(base::File* file);
39 } // namespace content
41 #endif // CONTENT_PUBLIC_COMMON_DWRITE_FONT_PLATFORM_WIN_H_