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 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/newfont1.png)
![](doc/newfont2.png) ![](doc/newfont2.png)
@ -204,3 +205,8 @@ Class digramm
└──┤ FRadioMenuItem ├---┘ └──┤ FRadioMenuItem ├---┘
└────────────────┘ └────────────────┘
</pre> </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(); int y_max = getHeight();
FDialog::draw(); FDialog::draw();
setColor(); setColor();
setPrintPos (10, 2);
print (wchar_t(fc::BoxDrawingsDownAndHorizontal)); if ( isNewFont() )
for (int y = 3; y < y_max; y++)
{ {
setPrintPos (10, y); for (int y = 2; y < y_max; y++)
print (wchar_t(fc::BoxDrawingsVertical)); {
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(); 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? ### 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 the terminal emulators
[xterm](http://invisible-island.net/xterm/xterm.html) [xterm](http://invisible-island.net/xterm/xterm.html)
or or
[urxvt](http://software.schmorp.de/pkg/rxvt-unicode.html), [urxvt](http://software.schmorp.de/pkg/rxvt-unicode.html),
because only these terminal emulators can change the font by because only these terminal emulators can change the font by
using an escape sequence. For an xterm, the "[Allow Font Ops](doc/xterm.txt)" using an escape sequence. For an xterm, the "[Allow Font Ops](../doc/xterm.txt)"
option must be set. option must be set.
#### Install the gzip compressed X11 pcf bitmap font 8x16graph.pcf.gz on your xserver: #### 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 /> 1. Create as user root the font directory<br />
`mkdir /usr/share/fonts/X11/misc/finalcut/` `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 /> into the just created directory<br />
`cp 8x16graph.pcf.gz fonts.dir fonts.alias /usr/share/fonts/X11/misc/finalcut/` `cp 8x16graph.pcf.gz fonts.dir fonts.alias /usr/share/fonts/X11/misc/finalcut/`

View File

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

View File

@ -2,3 +2,6 @@
8x16graph -misc-8x16graph-medium-r-normal--17-160-75-75-p-80-iso8859-1 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 -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 // public methods of FButtonGroup
//---------------------------------------------------------------------- //----------------------------------------------------------------------
FToggleButton* FButtonGroup::getButton(int index) const FToggleButton* FButtonGroup::getButton (int index) const
{ {
constFObjectIterator iter; constFObjectIterator iter;
index--; index--;
@ -546,6 +546,7 @@ void FButtonGroup::drawLabel()
i++; i++;
src++; src++;
} }
*dest++ = *src++; *dest++ = *src++;
} }

View File

@ -733,7 +733,7 @@ void FListView::onKeyPress (FKeyEvent* ev)
case fc::Fkey_left: case fc::Fkey_left:
if ( xoffset == 0 ) if ( xoffset == 0 )
{ {
if ( item->isExpandable() && item->isExpand() ) if ( tree_view && item->isExpandable() && item->isExpand() )
{ {
// Collapse element // Collapse element
item->collapse(); item->collapse();
@ -784,7 +784,7 @@ void FListView::onKeyPress (FKeyEvent* ev)
break; break;
case fc::Fkey_right: case fc::Fkey_right:
if ( item->isExpandable() && ! item->isExpand() ) if ( tree_view && item->isExpandable() && ! item->isExpand() )
{ {
// Expand element // Expand element
item->expand(); item->expand();
@ -841,15 +841,21 @@ void FListView::onKeyPress (FKeyEvent* ev)
break; break;
case int('+'): case int('+'):
item->expand(); if ( tree_view && item->isExpandable() && ! item->isExpand() )
adjustSize(); {
ev->accept(); item->expand();
adjustSize();
ev->accept();
}
break; break;
case int('-'): case int('-'):
item->collapse(); if ( tree_view && item->isExpandable() && item->isExpand() )
adjustSize(); {
ev->accept(); item->collapse();
adjustSize();
ev->accept();
}
break; break;
default: default:
@ -1093,7 +1099,7 @@ void FListView::onMouseDoubleClick (FMouseEvent* ev)
FListViewItem* item = getCurrentItem(); FListViewItem* item = getCurrentItem();
if ( item->isExpandable() ) if ( tree_view && item->isExpandable() )
{ {
if ( item->isExpand() ) if ( item->isExpand() )
item->collapse(); item->collapse();
@ -1549,7 +1555,7 @@ void FListView::drawColumnLabels()
first = h.begin() + xoffset; first = h.begin() + xoffset;
if ( int(h.size()) <= getClientWidth() ) if ( int(h.size()) <= getClientWidth() )
last = h.end() - 1; last = h.end();// - 1;
else else
{ {
int len = getClientWidth() + xoffset - 1; 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 // 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 ) if ( w < min_width )
w = min_width; w = min_width;
@ -199,7 +200,9 @@ bool FToggleButton::setChecked (bool on)
void FToggleButton::setText (const FString& txt) void FToggleButton::setText (const FString& txt)
{ {
text = 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() ) if ( isEnabled() )
{ {

View File

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