gfxFontMissingGlyphs.h (1754B)
1 /* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*- 2 * This Source Code Form is subject to the terms of the Mozilla Public 3 * License, v. 2.0. If a copy of the MPL was not distributed with this 4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 5 6 #ifndef GFX_FONTMISSINGGLYPHS_H 7 #define GFX_FONTMISSINGGLYPHS_H 8 9 #include "mozilla/gfx/MatrixFwd.h" 10 #include "mozilla/gfx/Rect.h" 11 12 namespace mozilla { 13 namespace gfx { 14 class DrawTarget; 15 class Pattern; 16 } // namespace gfx 17 } // namespace mozilla 18 19 /** 20 * This class should not be instantiated. It's just a container 21 * for some helper functions. 22 */ 23 class gfxFontMissingGlyphs final { 24 typedef mozilla::gfx::DrawTarget DrawTarget; 25 typedef mozilla::gfx::Float Float; 26 typedef mozilla::gfx::Matrix Matrix; 27 typedef mozilla::gfx::Pattern Pattern; 28 typedef mozilla::gfx::Rect Rect; 29 30 gfxFontMissingGlyphs() = delete; // prevent instantiation 31 32 public: 33 /** 34 * Draw hexboxes for a missing glyph. 35 * @param aChar the UTF16 codepoint for the character 36 * @param aRect the glyph-box for the glyph that is missing 37 * @param aDrawTarget the DrawTarget to draw to 38 * @param aPattern the pattern currently being used to paint 39 * @param aMat optional local-space orientation matrix 40 */ 41 static void DrawMissingGlyph(uint32_t aChar, const Rect& aRect, 42 DrawTarget& aDrawTarget, const Pattern& aPattern, 43 const Matrix* aMat = nullptr); 44 /** 45 * @return the desired minimum width for a glyph-box that will allow 46 * the hexboxes to be drawn reasonably. 47 */ 48 static Float GetDesiredMinWidth(uint32_t aChar, uint32_t aAppUnitsPerDevUnit); 49 50 static void Purge(); 51 52 static void Shutdown(); 53 }; 54 55 #endif