1 /* 2 SPDX-FileCopyrightText: 2019 Mariusz Glebocki <mglb@arccos-1.net> 3 4 SPDX-License-Identifier: GPL-2.0-or-later 5 */ 6 7 #ifndef LINEBLOCKCHARACTERS_H 8 #define LINEBLOCKCHARACTERS_H 9 10 // Qt 11 #include <QPainter> 12 13 namespace Konsole 14 { 15 /** 16 * Helper functions for drawing characters from "Box Drawing" and "Block Elements" Unicode blocks. 17 */ 18 namespace LineBlockCharacters 19 { 20 /** 21 * Returns true if the character can be drawn by draw() function. 22 * 23 * @param ucs4cp Character to test's UCS4 code point 24 */ canDraw(uint ucs4cp)25inline static bool canDraw(uint ucs4cp) 26 { 27 return (0x2500 <= ucs4cp && ucs4cp <= 0x259F); 28 } 29 30 /** 31 * Draws character. 32 * 33 * @param paint QPainter to draw on 34 * @param cellRect Rectangle to draw in 35 * @param chr Character to be drawn 36 * @param bold Whether the character should be boldface 37 */ 38 void draw(QPainter &paint, const QRect &cellRect, const QChar &chr, bool bold); 39 40 } // namespace LineBlockCharacters 41 } // namespace Konsole 42 43 #endif // LINEBLOCKCHARACTERS_H 44