Mercurial > jwe > octave
changeset 27834:ba4271934b1c
Remove special treatment of line drawing characters in libqterminal (bug #42136)
* TerminalView.[cpp,h]:
(isLineChar, isLineCharStr, drawLineChar, drawLineCharString): Remove functions.
(drawCharacters, updateImage, drawContents): Remove special treatment of line
drawing characters. Use the glyph from the font instead.
* LineFont.h: Remove unused file.
* libgui/qterminal/module.mk: Remove LineFont.h from noinst_HEADERS.
author | Markus Mützel <markus.muetzel@gmx.de> |
---|---|
date | Fri, 19 Jul 2019 20:48:56 +0200 |
parents | 0948ba09abbd |
children | 06bb894770e8 |
files | libgui/qterminal/libqterminal/unix/LineFont.h libgui/qterminal/libqterminal/unix/TerminalView.cpp libgui/qterminal/libqterminal/unix/TerminalView.h libgui/qterminal/module.mk |
diffstat | 4 files changed, 8 insertions(+), 143 deletions(-) [+] |
line wrap: on
line diff
--- a/libgui/qterminal/libqterminal/unix/LineFont.h Fri Dec 13 22:54:18 2019 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,21 +0,0 @@ -// WARNING: Autogenerated by "fontembedder ./linefont.src". -// You probably do not want to hand-edit this! - -static const quint32 LineChars[] = { - 0x00007c00, 0x000fffe0, 0x00421084, 0x00e739ce, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00427000, 0x004e7380, 0x00e77800, 0x00ef7bc0, - 0x00421c00, 0x00439ce0, 0x00e73c00, 0x00e7bde0, 0x00007084, 0x000e7384, 0x000079ce, 0x000f7bce, - 0x00001c84, 0x00039ce4, 0x00003dce, 0x0007bdee, 0x00427084, 0x004e7384, 0x004279ce, 0x00e77884, - 0x00e779ce, 0x004f7bce, 0x00ef7bc4, 0x00ef7bce, 0x00421c84, 0x00439ce4, 0x00423dce, 0x00e73c84, - 0x00e73dce, 0x0047bdee, 0x00e7bde4, 0x00e7bdee, 0x00427c00, 0x0043fce0, 0x004e7f80, 0x004fffe0, - 0x004fffe0, 0x00e7fde0, 0x006f7fc0, 0x00efffe0, 0x00007c84, 0x0003fce4, 0x000e7f84, 0x000fffe4, - 0x00007dce, 0x0007fdee, 0x000f7fce, 0x000fffee, 0x00427c84, 0x0043fce4, 0x004e7f84, 0x004fffe4, - 0x00427dce, 0x00e77c84, 0x00e77dce, 0x0047fdee, 0x004e7fce, 0x00e7fde4, 0x00ef7f84, 0x004fffee, - 0x00efffe4, 0x00e7fdee, 0x00ef7fce, 0x00efffee, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x000f83e0, 0x00a5294a, 0x004e1380, 0x00a57800, 0x00ad0bc0, 0x004390e0, 0x00a53c00, 0x00a5a1e0, - 0x000e1384, 0x0000794a, 0x000f0b4a, 0x000390e4, 0x00003d4a, 0x0007a16a, 0x004e1384, 0x00a5694a, - 0x00ad2b4a, 0x004390e4, 0x00a52d4a, 0x00a5a16a, 0x004f83e0, 0x00a57c00, 0x00ad83e0, 0x000f83e4, - 0x00007d4a, 0x000f836a, 0x004f93e4, 0x00a57d4a, 0x00ad836a, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00001c00, 0x00001084, 0x00007000, 0x00421000, - 0x00039ce0, 0x000039ce, 0x000e7380, 0x00e73800, 0x000e7f80, 0x00e73884, 0x0003fce0, 0x004239ce -};
--- a/libgui/qterminal/libqterminal/unix/TerminalView.cpp Fri Dec 13 22:54:18 2019 -0500 +++ b/libgui/qterminal/libqterminal/unix/TerminalView.cpp Fri Jul 19 20:48:56 2019 +0200 @@ -142,13 +142,6 @@ QCodec. */ -static inline bool isLineChar(quint16 c) { return ((c & 0xFF80) == 0x2500);} -static inline bool isLineCharString(const QString& string) -{ - return (string.length() > 0) && (isLineChar(string.at(0).unicode())); -} - - // assert for i in [0..31] : vt100extended(vt100_graphics[i]) == i. unsigned short vt100_graphics[32] = @@ -405,96 +398,6 @@ BotR = (1<<23) }; -#include "LineFont.h" - -static void drawLineChar(QPainter& paint, int x, int y, int w, int h, uchar code) -{ - //Calculate cell midpoints, end points. - int cx = x + w/2; - int cy = y + h/2; - int ex = x + w - 1; - int ey = y + h - 1; - - quint32 toDraw = LineChars[code]; - - //Top _lines: - if (toDraw & TopL) - paint.drawLine(cx-1, y, cx-1, cy-2); - if (toDraw & TopC) - paint.drawLine(cx, y, cx, cy-2); - if (toDraw & TopR) - paint.drawLine(cx+1, y, cx+1, cy-2); - - //Bot _lines: - if (toDraw & BotL) - paint.drawLine(cx-1, cy+2, cx-1, ey); - if (toDraw & BotC) - paint.drawLine(cx, cy+2, cx, ey); - if (toDraw & BotR) - paint.drawLine(cx+1, cy+2, cx+1, ey); - - //Left _lines: - if (toDraw & LeftT) - paint.drawLine(x, cy-1, cx-2, cy-1); - if (toDraw & LeftC) - paint.drawLine(x, cy, cx-2, cy); - if (toDraw & LeftB) - paint.drawLine(x, cy+1, cx-2, cy+1); - - //Right _lines: - if (toDraw & RightT) - paint.drawLine(cx+2, cy-1, ex, cy-1); - if (toDraw & RightC) - paint.drawLine(cx+2, cy, ex, cy); - if (toDraw & RightB) - paint.drawLine(cx+2, cy+1, ex, cy+1); - - //Intersection points. - if (toDraw & Int11) - paint.drawPoint(cx-1, cy-1); - if (toDraw & Int12) - paint.drawPoint(cx, cy-1); - if (toDraw & Int13) - paint.drawPoint(cx+1, cy-1); - - if (toDraw & Int21) - paint.drawPoint(cx-1, cy); - if (toDraw & Int22) - paint.drawPoint(cx, cy); - if (toDraw & Int23) - paint.drawPoint(cx+1, cy); - - if (toDraw & Int31) - paint.drawPoint(cx-1, cy+1); - if (toDraw & Int32) - paint.drawPoint(cx, cy+1); - if (toDraw & Int33) - paint.drawPoint(cx+1, cy+1); - -} - -void TerminalView::drawLineCharString( QPainter& painter, int x, int y, const QString& str, - const Character* attributes) -{ - const QPen& currentPen = painter.pen(); - - if ( attributes->rendition & RE_BOLD ) - { - QPen boldPen(currentPen); - boldPen.setWidth(3); - painter.setPen( boldPen ); - } - - for (int i=0 ; i < str.length(); i++) - { - uchar code = str[i].cell(); - if (LineChars[code]) - drawLineChar(painter, x + (_fontWidth*i), y, _fontWidth, _fontHeight, code); - } - - painter.setPen( currentPen ); -} - void TerminalView::setKeyboardCursorShape(KeyboardCursorShape shape) { _cursorShape = shape; @@ -626,18 +529,12 @@ painter.setPen(color); } // draw text - if ( isLineCharString(text) ) { - drawLineCharString(painter,rect.x(),rect.y(),text,style); - } - else - { - // the drawText(rect,flags,string) overload is used here with null flags - // instead of drawText(rect,string) because the (rect,string) overload causes - // the application's default layout direction to be used instead of - // the widget-specific layout direction, which should always be - // Qt::LeftToRight for this widget - painter.drawText(rect,0,text); - } + // the drawText(rect,flags,string) overload is used here with null flags + // instead of drawText(rect,string) because the (rect,string) overload causes + // the application's default layout direction to be used instead of + // the widget-specific layout direction, which should always be + // Qt::LeftToRight for this widget + painter.drawText(rect,0,text); } void TerminalView::drawTextFragment(QPainter& painter , @@ -903,7 +800,6 @@ continue; int p = 0; disstrU[p++] = c; //fontMap(c); - bool lineDraw = isLineChar(c); bool doubleWidth = (x+1 == columnsToUpdate) ? false : (newLine[x+1].character == 0); cr = newLine[x].rendition; _clipboard = newLine[x].backgroundColor; @@ -922,7 +818,6 @@ ch.backgroundColor != _clipboard || ch.rendition != cr || !dirtyMask[x+len] || - isLineChar(c) != lineDraw || nextIsDoubleWidth != doubleWidth ) break; @@ -932,8 +827,6 @@ QString unistr(disstrU, p); bool saveFixedFont = _fixedFont; - if (lineDraw) - _fixedFont = false; if (doubleWidth) _fixedFont = false; @@ -1287,7 +1180,6 @@ } } - bool lineDraw = isLineChar(c); bool doubleWidth = (_image[ qMin(loc(x,y)+1,_imageSize) ].character == 0); CharacterColor currentForeground = _image[loc(x,y)].foregroundColor; CharacterColor currentBackground = _image[loc(x,y)].backgroundColor; @@ -1297,9 +1189,9 @@ _image[loc(x+len,y)].foregroundColor == currentForeground && _image[loc(x+len,y)].backgroundColor == currentBackground && _image[loc(x+len,y)].rendition == currentRendition && - (_image[ qMin(loc(x+len,y)+1,_imageSize) ].character == 0) == doubleWidth && - isLineChar( c = _image[loc(x+len,y)].character) == lineDraw) // Assignment! + (_image[ qMin(loc(x+len,y)+1,_imageSize) ].character == 0) == doubleWidth) { + c = _image[loc(x+len,y)].character; if (c) disstrU[p++] = c; //fontMap(c); if (doubleWidth) // assert((_image[loc(x+len,y)+1].character == 0)), see above if condition @@ -1310,8 +1202,6 @@ len++; // Adjust for trailing part of multi-column character bool save__fixedFont = _fixedFont; - if (lineDraw) - _fixedFont = false; if (doubleWidth) _fixedFont = false; QString unistr(disstrU,p);
--- a/libgui/qterminal/libqterminal/unix/TerminalView.h Fri Dec 13 22:54:18 2019 -0500 +++ b/libgui/qterminal/libqterminal/unix/TerminalView.h Fri Jul 19 20:48:56 2019 +0200 @@ -576,9 +576,6 @@ // draws the characters or line graphics in a text fragment void drawCharacters(QPainter& painter, const QRect& rect, const QString& text, const Character* style, bool invertCharacterColor); - // draws a string of line graphics - void drawLineCharString(QPainter& painter, int x, int y, - const QString& str, const Character* attributes); // draws the preedit string for input methods void drawInputMethodPreeditString(QPainter& painter , const QRect& rect);
--- a/libgui/qterminal/module.mk Fri Dec 13 22:54:18 2019 -0500 +++ b/libgui/qterminal/module.mk Fri Jul 19 20:48:56 2019 +0200 @@ -14,7 +14,6 @@ %reldir%/libqterminal/unix/konsole_wcwidth.h \ %reldir%/libqterminal/unix/kpty.h \ %reldir%/libqterminal/unix/kpty_p.h \ - %reldir%/libqterminal/unix/LineFont.h \ %reldir%/libqterminal/unix/QUnixTerminalImpl.h \ %reldir%/libqterminal/unix/Screen.h \ %reldir%/libqterminal/unix/ScreenWindow.h \