| OLD | NEW | 
|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be | 
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. | 
| 4 | 4 | 
| 5 #ifndef UI_GFX_PLATFORM_FONT_PANGO_H_ | 5 #ifndef UI_GFX_PLATFORM_FONT_PANGO_H_ | 
| 6 #define UI_GFX_PLATFORM_FONT_PANGO_H_ | 6 #define UI_GFX_PLATFORM_FONT_PANGO_H_ | 
| 7 | 7 | 
| 8 #include <string> | 8 #include <string> | 
| 9 | 9 | 
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" | 
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 48   // Overridden from PlatformFont: | 48   // Overridden from PlatformFont: | 
| 49   virtual Font DeriveFont(int size_delta, int style) const OVERRIDE; | 49   virtual Font DeriveFont(int size_delta, int style) const OVERRIDE; | 
| 50   virtual int GetHeight() const OVERRIDE; | 50   virtual int GetHeight() const OVERRIDE; | 
| 51   virtual int GetBaseline() const OVERRIDE; | 51   virtual int GetBaseline() const OVERRIDE; | 
| 52   virtual int GetCapHeight() const OVERRIDE; | 52   virtual int GetCapHeight() const OVERRIDE; | 
| 53   virtual int GetAverageCharacterWidth() const OVERRIDE; | 53   virtual int GetAverageCharacterWidth() const OVERRIDE; | 
| 54   virtual int GetStringWidth(const base::string16& text) const OVERRIDE; | 54   virtual int GetStringWidth(const base::string16& text) const OVERRIDE; | 
| 55   virtual int GetExpectedTextWidth(int length) const OVERRIDE; | 55   virtual int GetExpectedTextWidth(int length) const OVERRIDE; | 
| 56   virtual int GetStyle() const OVERRIDE; | 56   virtual int GetStyle() const OVERRIDE; | 
| 57   virtual std::string GetFontName() const OVERRIDE; | 57   virtual std::string GetFontName() const OVERRIDE; | 
|  | 58   virtual std::string GetActualFontNameForTesting() const OVERRIDE; | 
| 58   virtual int GetFontSize() const OVERRIDE; | 59   virtual int GetFontSize() const OVERRIDE; | 
| 59   virtual NativeFont GetNativeFont() const OVERRIDE; | 60   virtual NativeFont GetNativeFont() const OVERRIDE; | 
| 60 | 61 | 
| 61  private: | 62  private: | 
| 62   // Create a new instance of this object with the specified properties. Called | 63   // Create a new instance of this object with the specified properties. Called | 
| 63   // from DeriveFont. | 64   // from DeriveFont. | 
| 64   PlatformFontPango(const skia::RefPtr<SkTypeface>& typeface, | 65   PlatformFontPango(const skia::RefPtr<SkTypeface>& typeface, | 
| 65                     const std::string& name, | 66                     const std::string& name, | 
| 66                     int size, | 67                     int size, | 
| 67                     int style); | 68                     int style); | 
| 68   virtual ~PlatformFontPango(); | 69   virtual ~PlatformFontPango(); | 
| 69 | 70 | 
| 70   // Returns a Pango font description (suitable for parsing by | 71   // Returns a Pango font description (suitable for parsing by | 
| 71   // pango_font_description_from_string()) for the default UI font. | 72   // pango_font_description_from_string()) for the default UI font. | 
| 72   static std::string GetDefaultFont(); | 73   static std::string GetDefaultFont(); | 
| 73 | 74 | 
| 74   // Initialize this object. | 75   // Initialize this object. | 
| 75   void InitWithNameAndSize(const std::string& font_name, int font_size); | 76   void InitWithNameAndSize(const std::string& font_name, int font_size); | 
| 76   void InitWithTypefaceNameSizeAndStyle( | 77   void InitWithTypefaceNameSizeAndStyle( | 
| 77       const skia::RefPtr<SkTypeface>& typeface, | 78       const skia::RefPtr<SkTypeface>& typeface, | 
| 78       const std::string& name, | 79       const std::string& font_family, | 
| 79       int size, | 80       int font_size, | 
| 80       int style); | 81       int style); | 
| 81   void InitFromPlatformFont(const PlatformFontPango* other); | 82   void InitFromPlatformFont(const PlatformFontPango* other); | 
| 82 | 83 | 
| 83   // Potentially slow call to get pango metrics (average width, underline info). | 84   // Potentially slow call to get pango metrics (average width, underline info). | 
| 84   void InitPangoMetrics(); | 85   void InitPangoMetrics(); | 
| 85 | 86 | 
| 86   // Setup a Skia context to use the current typeface. | 87   // Setup a Skia context to use the current typeface. | 
| 87   void PaintSetup(SkPaint* paint) const; | 88   void PaintSetup(SkPaint* paint) const; | 
| 88 | 89 | 
| 89   // Make |this| a copy of |other|. | 90   // Make |this| a copy of |other|. | 
| (...skipping 27 matching lines...) Expand all  Loading... | 
| 117 #if defined(OS_CHROMEOS) | 118 #if defined(OS_CHROMEOS) | 
| 118   static std::string* default_font_description_; | 119   static std::string* default_font_description_; | 
| 119 #endif | 120 #endif | 
| 120 | 121 | 
| 121   DISALLOW_COPY_AND_ASSIGN(PlatformFontPango); | 122   DISALLOW_COPY_AND_ASSIGN(PlatformFontPango); | 
| 122 }; | 123 }; | 
| 123 | 124 | 
| 124 }  // namespace gfx | 125 }  // namespace gfx | 
| 125 | 126 | 
| 126 #endif  // UI_GFX_PLATFORM_FONT_PANGO_H_ | 127 #endif  // UI_GFX_PLATFORM_FONT_PANGO_H_ | 
| OLD | NEW | 
|---|