Small NewFont improvements

This commit is contained in:
Markus Gans 2017-11-03 05:04:27 +01:00
parent 19c8dd50a9
commit 1bf4f2f906
9 changed files with 74 additions and 30 deletions

View File

@ -33,7 +33,8 @@ The C++ class design was inspired by the Qt framework. It provides common contro
newfont
-------
A new text font for X11 and the Linux console.
A [graphical text font](fonts/) for X11 and the Linux console.
![](doc/newfont1.png)
![](doc/newfont2.png)
@ -204,3 +205,8 @@ Class digramm
└──┤ FRadioMenuItem ├---┘
└────────────────┘
</pre>
Please send bug reports to
--------------------------
https://github.com/gansm/finalcut/issues

View File

@ -410,17 +410,33 @@ void MouseDraw::draw()
int y_max = getHeight();
FDialog::draw();
setColor();
setPrintPos (10, 2);
print (wchar_t(fc::BoxDrawingsDownAndHorizontal));
for (int y = 3; y < y_max; y++)
if ( isNewFont() )
{
setPrintPos (10, y);
print (wchar_t(fc::BoxDrawingsVertical));
for (int y = 2; y < y_max; y++)
{
setPrintPos (10, y);
print (wchar_t(fc::NF_rev_border_line_right));
}
setPrintPos (10, y_max);
print (wchar_t(fc::NF_rev_border_corner_lower_right));
}
else
{
setPrintPos (10, 2);
print (wchar_t(fc::BoxDrawingsDownAndHorizontal));
for (int y = 3; y < y_max; y++)
{
setPrintPos (10, y);
print (wchar_t(fc::BoxDrawingsVertical));
}
setPrintPos (10, y_max);
print (wchar_t(fc::BoxDrawingsUpAndHorizontal));
}
setPrintPos (10, y_max);
print (wchar_t(fc::BoxDrawingsUpAndHorizontal));
drawCanvas();
}

View File

@ -4,13 +4,13 @@ Simply start your program with the parameter `--newfont`.
### How can I use the new graphical font under X11?
The use of the new graphical font under X11 is only possible with
The use of the new graphical font under X11 is only possible with
the terminal emulators
[xterm](http://invisible-island.net/xterm/xterm.html)
or
[urxvt](http://software.schmorp.de/pkg/rxvt-unicode.html),
because only these terminal emulators can change the font by
using an escape sequence. For an xterm, the "[Allow Font Ops](doc/xterm.txt)"
[urxvt](http://software.schmorp.de/pkg/rxvt-unicode.html),
because only these terminal emulators can change the font by
using an escape sequence. For an xterm, the "[Allow Font Ops](../doc/xterm.txt)"
option must be set.
#### Install the gzip compressed X11 pcf bitmap font 8x16graph.pcf.gz on your xserver:
@ -18,7 +18,7 @@ option must be set.
1. Create as user root the font directory<br />
`mkdir /usr/share/fonts/X11/misc/finalcut/`
2. Copy the files 8x16graph.pcf.gz, fonts.dir and fonts.alias
2. Copy the files 8x16graph.pcf.gz, fonts.dir and fonts.alias
into the just created directory<br />
`cp 8x16graph.pcf.gz fonts.dir fonts.alias /usr/share/fonts/X11/misc/finalcut/`

View File

@ -1,5 +1,6 @@
#!/bin/bash
test -f 8x16graph.pcf.gz && rm 8x16graph.pcf.gz
bdftopcf -o 8x16graph.pcf 8x16graph.bdf
gzip -9 8x16graph.pcf

View File

@ -2,3 +2,6 @@
8x16graph -misc-8x16graph-medium-r-normal--17-160-75-75-p-80-iso8859-1
-misc-8x16graph-medium-r-normal--17-160-75-75-p-80-ibm-cp437 -misc-8x16graph-medium-r-normal--17-160-75-75-p-80-iso8859-1
!----------------------------------------
! Note: urxvt can't load a ibm-cp437 font
!----------------------------------------

View File

@ -71,7 +71,7 @@ FButtonGroup::~FButtonGroup() // destructor
// public methods of FButtonGroup
//----------------------------------------------------------------------
FToggleButton* FButtonGroup::getButton(int index) const
FToggleButton* FButtonGroup::getButton (int index) const
{
constFObjectIterator iter;
index--;
@ -546,6 +546,7 @@ void FButtonGroup::drawLabel()
i++;
src++;
}
*dest++ = *src++;
}

View File

@ -733,7 +733,7 @@ void FListView::onKeyPress (FKeyEvent* ev)
case fc::Fkey_left:
if ( xoffset == 0 )
{
if ( item->isExpandable() && item->isExpand() )
if ( tree_view && item->isExpandable() && item->isExpand() )
{
// Collapse element
item->collapse();
@ -784,7 +784,7 @@ void FListView::onKeyPress (FKeyEvent* ev)
break;
case fc::Fkey_right:
if ( item->isExpandable() && ! item->isExpand() )
if ( tree_view && item->isExpandable() && ! item->isExpand() )
{
// Expand element
item->expand();
@ -841,15 +841,21 @@ void FListView::onKeyPress (FKeyEvent* ev)
break;
case int('+'):
item->expand();
adjustSize();
ev->accept();
if ( tree_view && item->isExpandable() && ! item->isExpand() )
{
item->expand();
adjustSize();
ev->accept();
}
break;
case int('-'):
item->collapse();
adjustSize();
ev->accept();
if ( tree_view && item->isExpandable() && item->isExpand() )
{
item->collapse();
adjustSize();
ev->accept();
}
break;
default:
@ -1093,7 +1099,7 @@ void FListView::onMouseDoubleClick (FMouseEvent* ev)
FListViewItem* item = getCurrentItem();
if ( item->isExpandable() )
if ( tree_view && item->isExpandable() )
{
if ( item->isExpand() )
item->collapse();
@ -1549,7 +1555,7 @@ void FListView::drawColumnLabels()
first = h.begin() + xoffset;
if ( int(h.size()) <= getClientWidth() )
last = h.end() - 1;
last = h.end();// - 1;
else
{
int len = getClientWidth() + xoffset - 1;

View File

@ -89,7 +89,8 @@ void FToggleButton::setGeometry (int x, int y, int w, int h, bool adjust)
{
// Set the toggle button geometry
int min_width = button_width + int(text.getLength());
int hotkey_mark = ( getHotkey() ) ? 1 : 0;
int min_width = button_width + int(text.getLength()) - hotkey_mark;
if ( w < min_width )
w = min_width;
@ -199,7 +200,9 @@ bool FToggleButton::setChecked (bool on)
void FToggleButton::setText (const FString& txt)
{
text = txt;
setWidth(button_width + int(text.getLength()));
int hotkey_mark = ( getHotkey() ) ? 1 : 0;
setWidth(button_width + int(text.getLength()) - hotkey_mark);
if ( isEnabled() )
{

View File

@ -2737,9 +2737,17 @@ inline void FVTerm::charsetChanges (char_data*& next_char)
else if ( Encoding == fc::PC )
{
next_char->attr.bit.pc_charset = true;
// Character 0x00..0x1f
if ( isXTerminal() && hasUTF8() && ch_enc < 0x20 )
next_char->code = int(charEncode(code, fc::ASCII));
if ( isXTerminal() && ch_enc < 0x20 ) // Character 0x00..0x1f
{
if ( hasUTF8() )
next_char->code = int(charEncode(code, fc::ASCII));
else
{
next_char->code += 0x5f;
next_char->attr.bit.alt_charset = true;
}
}
}
}
}