1 // Copyright 2013 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. 4 5 #ifndef UI_GFX_LINUX_FONT_DELEGATE_H_ 6 #define UI_GFX_LINUX_FONT_DELEGATE_H_ 7 8 #include <string> 9 10 #include "base/memory/scoped_ptr.h" 11 #include "ui/gfx/font_render_params.h" 12 #include "ui/gfx/gfx_export.h" 13 14 namespace gfx { 15 16 class ScopedPangoFontDescription; 17 18 // Allows a Linux platform-specific overriding of font preferences. 19 class GFX_EXPORT LinuxFontDelegate { 20 public: ~LinuxFontDelegate()21 virtual ~LinuxFontDelegate() {} 22 23 // Sets the dynamically loaded singleton that provides font preferences. 24 // This pointer is not owned, and if this method is called a second time, 25 // the first instance is not deleted. 26 static void SetInstance(LinuxFontDelegate* instance); 27 28 // Returns a LinuxFontDelegate instance for the toolkit used in 29 // the user's desktop environment. 30 // 31 // Can return NULL, in case no toolkit has been set. (For example, if we're 32 // running with the "--ash" flag.) 33 static const LinuxFontDelegate* instance(); 34 35 // Returns the default font rendering settings. 36 virtual FontRenderParams GetDefaultFontRenderParams() const = 0; 37 38 // Returns the Pango description for the default UI font. 39 virtual scoped_ptr<ScopedPangoFontDescription> 40 GetDefaultPangoFontDescription() const = 0; 41 42 // Returns the resolution (as pixels-per-inch) that should be used to convert 43 // font sizes between points and pixels. -1 is returned if the DPI is unset. 44 virtual double GetFontDPI() const = 0; 45 }; 46 47 } // namespace gfx 48 49 #endif // UI_GFX_LINUX_FONT_DELEGATE_H_ 50