1
0
mirror of https://github.com/Swordfish90/cool-retro-term.git synced 2025-02-21 04:19:00 +00:00

New fonts and font management improved.

This commit is contained in:
Filippo Scognamiglio 2014-03-24 21:40:04 +01:00
parent 87880e08fd
commit 06b9627c6c
35 changed files with 111 additions and 253 deletions

View File

@ -1,98 +0,0 @@
/*******************************************************************************
* Copyright (c) 2013 Jørgen Lind
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
*******************************************************************************/
import QtQuick 2.0
Item {
id: highlightArea
property real characterWidth: 0
property real characterHeight: 0
property int screenWidth: width / characterWidth
property point start
property point end
property color color: "grey"
width: parent.width
height: parent.height
opacity: 0.8
Rectangle {
id: begginning_rectangle
color: parent.color
opacity: parent.opacity
y:0
height: characterHeight
}
Rectangle {
id: middle_rectangle
color: parent.color
opacity: parent.opacity
width: parent.width
x: 0
anchors.top: begginning_rectangle.bottom
}
Rectangle {
id: end_rectangle
color: parent.color
opacity: parent.opacity
x: 0
height: characterHeight
anchors.top: middle_rectangle.bottom
}
onCharacterWidthChanged: calculateRectangles();
onCharacterHeightChanged: calculateRectangles();
onScreenWidthChanged: calculateRectangles();
onStartChanged: calculateRectangles();
onEndChanged: calculateRectangles();
function calculateRectangles() {
highlightArea.y = start.y * characterHeight;
begginning_rectangle.x = start.x * characterWidth;
if (start.y === end.y) {
middle_rectangle.visible = false;
end_rectangle.visible = false
begginning_rectangle.width = (end.x - start.x) * characterWidth;
} else {
begginning_rectangle.width = (screenWidth - start.x) * characterWidth;
if (start.y === end.y - 1) {
middle_rectangle.height = 0;
middle_rectangle.visible = false;
}else {
middle_rectangle.visible = true;
middle_rectangle.height = (end.y - start.y - 1) * characterHeight;
}
end_rectangle.visible = true;
end_rectangle.width = end.x * characterWidth;
}
}
}

View File

@ -41,7 +41,7 @@ Item{
property int frames_index: 2
property var frames_list: framelist
property real font_scaling: 0.7
property real font_scaling: 1.0
property var font: currentfont
property real fontSize: currentfont.pixelSize * font_scaling
property int font_index: 0
@ -56,11 +56,13 @@ Item{
terminal.source = "";
currentfont.source = fontlist.get(font_index).source;
currentfont.pixelSize = fontlist.get(font_index).pixelSize;
currentfont.lineSpacing = fontlist.get(font_index).lineSpacing;
terminal.source = "Terminal.qml";
}
FontLoader{
property int pixelSize: fontlist.get(font_index).pixelSize
property int lineSpacing: fontlist.get(font_index).lineSpacing
id: currentfont
source: fontlist.get(font_index).source
}
@ -75,24 +77,46 @@ Item{
ListModel{
id: fontlist
ListElement{
text: "Commodore PET (1977)"
source: "fonts/CommodorePET/COMMODORE_PET.ttf"
pixelSize: 20
text: "Terminus (Modern)"
source: "fonts/modern-terminus/TerminusTTF-4.38.2.ttf"
pixelSize: 22
lineSpacing: 0
}
ListElement{
text: "Atari 8bit (1979)"
source: "fonts/Atari8bit/ATARI400800_original.TTF"
pixelSize: 20
text: "Commodore PET (1977)"
source: "fonts/1977-commodore-pet/COMMODORE_PET.ttf"
pixelSize: 15
lineSpacing: 0
}
ListElement{
text: "Apple ][ (1977)"
source: "fonts/1977-apple2/PrintChar21.ttf"
pixelSize: 18
lineSpacing: 0
}
ListElement{
text: "Atari 400-800 (1979)"
source: "fonts/1979-atari-400-800/ATARI400800_original.TTF"
pixelSize: 16
lineSpacing: 0
}
ListElement{
text: "Commodore 64 (1982)"
source: "fonts/Commodore64/C64_User_Mono_v1.0-STYLE.ttf"
pixelSize: 20
source: "fonts/1982-commodore64/C64_User_Mono_v1.0-STYLE.ttf"
pixelSize: 16
lineSpacing: 0
}
ListElement{
text: "Atari ST (1985)"
source: "fonts/1985-atari-st/AtariST8x16SystemFont.ttf"
pixelSize: 18
lineSpacing: 0
}
ListElement{
text: "IBM DOS (1985)"
source: "fonts/Dos/Perfect DOS VGA 437.ttf"
pixelSize: 32
source: "fonts/1985-ibm-pc-vga/Perfect DOS VGA 437.ttf"
pixelSize: 20
lineSpacing: 0
}
}

View File

@ -1,137 +0,0 @@
/*******************************************************************************
* Copyright (c) 2013 "Filippo Scognamiglio"
* https://github.com/Swordifish90/cool-old-term
*
* This file is part of cool-old-term.
*
* cool-old-term is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*******************************************************************************/
import QtQuick 2.1
import QtQuick.Window 2.0
import QtQuick.Controls 1.0
import QtGraphicalEffects 1.0
import org.kde.konsole 0.1
ApplicationWindow{
id: terminalWindow
width: 1024
height: 768
title: qsTr("Terminal")
Action {
id: fullscreenAction
text: "&Fullscreen"
shortcut: "Alt+F11"
onTriggered: shadersettings.fullscreen = !shadersettings.fullscreen;
}
Action {
id: quitAction
text: "&Quit"
shortcut: "Ctrl+Q"
onTriggered: terminalWindow.close();
}
Action{
id: showsettingsAction
text: "&Settings"
onTriggered: settingswindow.show();
}
menuBar: MenuBar {
id: menubar
Menu {
title: qsTr("File")
visible: shadersettings.fullscreen ? false : true
MenuItem {action: quitAction}
}
Menu {
title: qsTr("Edit")
visible: shadersettings.fullscreen ? false : true
MenuItem {action: showsettingsAction}
MenuItem {action: fullscreenAction}
}
}
visible: true
visibility: shadersettings.fullscreen ? Window.FullScreen : Window.Windowed
Item{
id: maincontainer
anchors.fill: parent
clip: true
ShaderEffectSource{
id: theSource
sourceItem: terminal
sourceRect: frame.sourceRect
}
ShaderManager{
id: shadercontainer
anchors.fill: terminal
blending: true
z: 1.9
}
Loader{
property rect sourceRect: item.sourceRect
id: frame
anchors.fill: parent
z: 2.1
source: shadersettings.frame_source
}
KTerminal {
id: terminal
font.pointSize: shadersettings.fontSize
font.family: shadersettings.font.name
colorScheme: "WhiteOnBlack"
width: parent.width
height: parent.height
session: KSession {
id: ksession
kbScheme: "linux"
onFinished: {
Qt.quit()
}
}
Component.onCompleted: {
font.pointSize = shadersettings.fontSize;
font.family = shadersettings.font.name;
console.log(shadersettings.font.name);
}
}
RadialGradient{
id: ambientreflection
z: 2.0
anchors.fill: parent
cached: true
opacity: shadersettings.ambient_light * 0.66
gradient: Gradient{
GradientStop{position: 0.0; color: "white"}
GradientStop{position: 0.7; color: "#00000000"}
}
}
}
}

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject>
<!-- Written by QtCreator 3.0.0, 2014-01-19T22:57:55. -->
<!-- Written by QtCreator 3.0.1, 2014-03-24T21:35:08. -->
<qtcreator>
<data>
<variable>ProjectExplorer.Project.ActiveTarget</variable>
@ -51,9 +51,9 @@
<data>
<variable>ProjectExplorer.Project.Target.0</variable>
<valuemap type="QVariantMap">
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Desktop Qt 5.2.0 GCC 64bit</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop Qt 5.2.0 GCC 64bit</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">qt.520.gcc_64.essentials_kit</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Desktop</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">{821020a0-a534-46a2-aed8-40a3bc73356b}</value>
<value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">-1</value>
<value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value>
<value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>
@ -130,7 +130,7 @@
</data>
<data>
<variable>ProjectExplorer.Project.Updater.EnvironmentId</variable>
<value type="QByteArray">{76aa359f-2663-43c5-a318-565e5b679f49}</value>
<value type="QByteArray">{ce9500eb-fe4b-414b-b912-5f93dee048a3}</value>
</data>
<data>
<variable>ProjectExplorer.Project.Updater.FileVersion</variable>

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,20 @@
KREATIVE SOFTWARE RELAY FONTS FREE USE LICENSE
version 1.2f
Permission is hereby granted, free of charge, to any person or entity (the "User") obtaining a copy of the included font files (the "Software") produced by Kreative Software, to utilize, display, embed, or redistribute the Software, subject to the following conditions:
1. The User may not sell copies of the Software for a fee.
1a. The User may give away copies of the Software free of charge provided this license and any documentation is included verbatim and credit is given to Kreative Korporation or Kreative Software.
2. The User may not modify, reverse-engineer, or create any derivative works of the Software.
3. Any Software carrying the following font names or variations thereof is not covered by this license and may not be used under the terms of this license: Jewel Hill, Miss Diode n Friends, This is Beckie's font!
3a. Any Software carrying a font name ending with the string "Pro CE" is not covered by this license and may not be used under the terms of this license.
4. This license becomes null and void if any of the above conditions are not met.
5. Kreative Software reserves the right to change this license at any time without notice.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND NONINFRINGEMENT OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF THE USE OR INABILITY TO USE THE SOFTWARE OR FROM OTHER DEALINGS IN THE SOFTWARE.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,42 @@
# example scheme for konsole
# the title is to appear in the menu.
title White on Black
# foreground colors
# note that the default background color is flagged
# to become transparent when an image is present.
# slot transparent bold
# | | |
# V V--color--V V V
color 0 255 255 255 0 0 # regular foreground color (White)
color 1 0 0 0 1 0 # regular background color (Black)
color 2 0 0 0 0 0 # regular color 0 Black
color 3 255 255 255 0 0 # regular color 1 Red
color 4 255 255 255 0 0 # regular color 2 Green
color 5 255 255 255 0 0 # regular color 3 Yellow
color 6 255 255 255 0 0 # regular color 4 Blue
color 7 255 255 255 0 0 # regular color 5 Magenta
color 8 255 255 255 0 0 # regular color 6 Cyan
color 9 255 255 255 0 0 # regular color 7 White
# intensive colors
# instead of changing the colors, we've flaged the text to become bold
color 10 255 255 255 0 1 # intensive foreground color
color 11 0 0 0 1 0 # intensive background color
color 12 255 255 255 0 0 # intensive color 0
color 13 255 255 255 0 0 # intensive color 1
color 14 255 255 255 0 0 # intensive color 2
color 15 255 255 255 0 0 # intensive color 3
color 16 255 255 255 0 0 # intensive color 4
color 17 255 255 255 0 0 # intensive color 5
color 18 255 255 255 0 0 # intensive color 6
color 19 255 255 255 0 0 # intensive color 7

View File

@ -155,7 +155,7 @@ KTerminalDisplay::KTerminalDisplay(QQuickItem *parent) :
,_isFixedSize(false)
,_resizeTimer(0)
,_flowControlWarningEnabled(false)
,_lineSpacing(0)
,_lineSpacing(2)
,_colorsInverted(false)
,_cursorShape(BlockCursor)
,m_session(0)

View File

@ -70,6 +70,7 @@ class KONSOLEPRIVATE_EXPORT KTerminalDisplay : public QQuickPaintedItem
Q_PROPERTY(bool ShowIMEOnClick READ autoVKB WRITE setAutoVKB NOTIFY changedAutoVKB)
public:
KTerminalDisplay(QQuickItem *parent = 0);
~KTerminalDisplay();
@ -95,7 +96,7 @@ public:
/** Specifies whether or not text can blink. */
void setBlinkingTextEnabled(bool blink);
void setLineSpacing(uint);
Q_INVOKABLE void setLineSpacing(uint);
uint lineSpacing() const;
void emitSelection(bool useXselection,bool appendReturn);

View File

@ -165,5 +165,11 @@ Module {
Parameter { name: "session"; type: "KSession"; isPointer: true }
}
Method { name: "getSession"; type: "KSession*" }
//My additions
Method {
name: "setLineSpacing"
Parameter { name: "i"; type: "uint"}
}
}
}