Ubuntu Monospace font
This commit is contained in:
parent
73981aca6f
commit
46338d2b93
6 changed files with 110 additions and 125 deletions
|
|
@ -1,3 +1,4 @@
|
|||
Manifest-Version: 1.0
|
||||
Main-Class: net.infordata.em.Main
|
||||
Created-By: 17.0.13 (Debian)
|
||||
|
||||
|
|
|
|||
7
build.sh
7
build.sh
|
|
@ -3,7 +3,7 @@
|
|||
# Let's go to the folder containing the build.sh file
|
||||
# We don't want to remove all .class files on the system should
|
||||
# the script run on /
|
||||
VERSION="0.1-1.19i"
|
||||
VERSION="0.2.1"
|
||||
BASEDIR=$(dirname $0)
|
||||
echo $BASEDIR
|
||||
cd $BASEDIR
|
||||
|
|
@ -13,9 +13,10 @@ cd $BASEDIR
|
|||
find . -name "*.class" | xargs rm -rf
|
||||
|
||||
find . -name "*.java" > .javasources.txt
|
||||
javac -target 7 -source 7 -encoding "ISO8859-1" @.javasources.txt
|
||||
javac -encoding "ISO8859-1" @.javasources.txt
|
||||
#rm -f .javasources.txt
|
||||
|
||||
JARFILE="xtn5250mg-${VERSION}.jar"
|
||||
rm -f $JARFILE
|
||||
jar cvmf META-INF/MANIFEST.MF $JARFILE build.sh net README logging.properties -C res res
|
||||
jar cvmf META-INF/MANIFEST.MF $JARFILE build.sh net -C res res
|
||||
find . -name "*.class" | xargs rm -rf
|
||||
|
|
|
|||
|
|
@ -20,10 +20,10 @@ import net.infordata.em.crt5250.XI5250Field;
|
|||
import net.infordata.em.crt5250.XIEbcdicTranslator;
|
||||
import net.infordata.em.tn5250.XI5250Emulator;
|
||||
import net.infordata.em.tn5250.XI5250Frame;
|
||||
import net.infordata.em.tn5250ext.PSHBTNCHCHandler;
|
||||
import net.infordata.em.tn5250ext.XI5250EmulatorExt;
|
||||
import net.infordata.em.tn5250ext.XI5250PanelHandler;
|
||||
import net.infordata.em.tn5250ext.XI5250PanelsDispatcher;
|
||||
//import net.infordata.em.tn5250ext.PSHBTNCHCHandler;
|
||||
//import net.infordata.em.tn5250ext.XI5250EmulatorExt;
|
||||
//import net.infordata.em.tn5250ext.XI5250PanelHandler;
|
||||
//import net.infordata.em.tn5250ext.XI5250PanelsDispatcher;
|
||||
import net.infordata.em.tn5250.XIImagesBdl;
|
||||
|
||||
|
||||
|
|
@ -41,7 +41,7 @@ public class Main {
|
|||
|
||||
private static void usageError(String msg) {
|
||||
System.err.println(msg);
|
||||
System.err.println("Usage: [-3dFX] [-PSHBTNCHC] [-STRPCCMD] [-altFKeyRemap]" +
|
||||
System.err.println("Usage: [-3dFX] /*[-PSHBTNCHC]*/ [-STRPCCMD] [-altFKeyRemap]" +
|
||||
" [-maximized] [-cp codepage] [-devName name]" +
|
||||
" [-autoLogon <fieldsCount>;<usrFieldLabel>;<pwdFieldLabel>;<user>;<passwd>]" +
|
||||
" host-name");
|
||||
|
|
@ -59,11 +59,7 @@ public class Main {
|
|||
fntSize = fontSize;
|
||||
}
|
||||
InputStream is = null;
|
||||
try {
|
||||
is = new FileInputStream("/tmp/Inconsolata.otf");
|
||||
} catch (FileNotFoundException ex) {
|
||||
System.err.println("file not found font : " + ex);
|
||||
}
|
||||
is = theClass.getResourceAsStream("/res/ubuntu-mono-regular.ttf");
|
||||
Font font = null;
|
||||
try {
|
||||
System.err.println(" createFont Testing res/" + fontFileName + " ... ");
|
||||
|
|
@ -90,7 +86,7 @@ public class Main {
|
|||
|
||||
boolean pUse3dFX = false;
|
||||
boolean pAltFKeyRemap = false;
|
||||
boolean pPSHBTNCHC = false;
|
||||
//boolean pPSHBTNCHC = false;
|
||||
boolean pSTRPCCMD = false;
|
||||
boolean pMaximized = false;
|
||||
|
||||
|
|
@ -107,8 +103,8 @@ public class Main {
|
|||
if (arg.startsWith("-")) {
|
||||
if ("-3dfx".equalsIgnoreCase(arg))
|
||||
pUse3dFX = true;
|
||||
else if ("-PSHBTNCHC".equalsIgnoreCase(arg))
|
||||
pPSHBTNCHC = true;
|
||||
// else if ("-PSHBTNCHC".equalsIgnoreCase(arg))
|
||||
// pPSHBTNCHC = true;
|
||||
else if ("-STRPCCMD".equalsIgnoreCase(arg))
|
||||
pSTRPCCMD = true;
|
||||
else if ("-maximized".equalsIgnoreCase(arg))
|
||||
|
|
@ -155,7 +151,7 @@ public class Main {
|
|||
|
||||
final boolean altFKeyRemap = pAltFKeyRemap;
|
||||
final boolean use3dFX = pUse3dFX;
|
||||
final boolean enablePSHBTNCHC = pPSHBTNCHC;
|
||||
// final boolean enablePSHBTNCHC = pPSHBTNCHC;
|
||||
final boolean enableSTRPCCMD = pSTRPCCMD;
|
||||
final boolean maximized = pMaximized;
|
||||
final String host = pHost;
|
||||
|
|
@ -166,25 +162,26 @@ public class Main {
|
|||
SwingUtilities.invokeAndWait(new Runnable() {
|
||||
public void run() {
|
||||
XI5250Emulator em;
|
||||
if (enablePSHBTNCHC) {
|
||||
XI5250EmulatorExt emext = new XI5250EmulatorExt();
|
||||
PanelsDispatcher disp = new PanelsDispatcher();
|
||||
disp.setEmulator(emext);
|
||||
new PSHBTNCHCHandler(disp);
|
||||
if (autoLogonInfo != null)
|
||||
new AutoLogonHandler(disp, autoLogonInfo);
|
||||
em = emext;
|
||||
}
|
||||
else if (autoLogonInfo != null) {
|
||||
XI5250EmulatorExt emext = new XI5250EmulatorExt();
|
||||
PanelsDispatcher disp = new PanelsDispatcher();
|
||||
disp.setEmulator(emext);
|
||||
new AutoLogonHandler(disp, autoLogonInfo);
|
||||
em = emext;
|
||||
}
|
||||
else {
|
||||
// if (enablePSHBTNCHC) {
|
||||
// XI5250EmulatorExt emext = new XI5250EmulatorExt();
|
||||
// PanelsDispatcher disp = new PanelsDispatcher();
|
||||
// disp.setEmulator(emext);
|
||||
// new PSHBTNCHCHandler(disp);
|
||||
// if (autoLogonInfo != null)
|
||||
// new AutoLogonHandler(disp, autoLogonInfo);
|
||||
// em = emext;
|
||||
// }
|
||||
// else if (autoLogonInfo != null) {
|
||||
// if (autoLogonInfo != null) {
|
||||
// XI5250EmulatorExt emext = new XI5250EmulatorExt();
|
||||
// PanelsDispatcher disp = new PanelsDispatcher();
|
||||
// disp.setEmulator(emext);
|
||||
// new AutoLogonHandler(disp, autoLogonInfo);
|
||||
// em = emext;
|
||||
// }
|
||||
// else {
|
||||
em = new XI5250Emulator();
|
||||
}
|
||||
// }
|
||||
em.setTerminalType("IBM-3477-FC");
|
||||
em.setKeyboardQueue(true);
|
||||
|
||||
|
|
@ -200,11 +197,8 @@ public class Main {
|
|||
em.setActive(true);
|
||||
}
|
||||
|
||||
Font mahefaFont = loadFontFromResource(Main.class, "MonoSpaced", 1);
|
||||
em.setFont(mahefaFont);
|
||||
XI5250Frame frm = new XI5250Frame("xtn5250mg" + " " +
|
||||
XI5250Emulator.VERSION, em);
|
||||
frm.setFont(mahefaFont);
|
||||
frm.setIconImage(cvImagesBdl.getImage("Logo"));
|
||||
|
||||
frm.addWindowListener(new WindowAdapter() {
|
||||
|
|
@ -240,36 +234,36 @@ public class Main {
|
|||
|
||||
//////
|
||||
|
||||
private static class PanelsDispatcher extends XI5250PanelsDispatcher {
|
||||
|
||||
private AutoLogonHandler ivAutoLogonHandler;
|
||||
private XI5250PanelHandler ivHandler;
|
||||
|
||||
@Override
|
||||
public synchronized void addPanelHandler(XI5250PanelHandler panel) {
|
||||
if (panel instanceof AutoLogonHandler) {
|
||||
if (ivAutoLogonHandler != null)
|
||||
throw new IllegalArgumentException("Handler already setted");
|
||||
ivAutoLogonHandler = (AutoLogonHandler)panel;
|
||||
return;
|
||||
}
|
||||
if (ivHandler != null)
|
||||
throw new IllegalArgumentException("Handler already setted");
|
||||
ivHandler = panel;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected synchronized XI5250PanelHandler getCurrentPanelHandler() {
|
||||
return (ivAutoLogonHandler != null && ivAutoLogonHandler.detailedTest()) ? ivAutoLogonHandler : ivHandler;
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized void removePanelHandler(XI5250PanelHandler panel) {
|
||||
if (ivHandler != panel)
|
||||
throw new IllegalArgumentException("Not the registered handler " + panel);
|
||||
ivHandler = null;
|
||||
}
|
||||
}
|
||||
// private static class PanelsDispatcher extends XI5250PanelsDispatcher {
|
||||
//
|
||||
// private AutoLogonHandler ivAutoLogonHandler;
|
||||
// private XI5250PanelHandler ivHandler;
|
||||
//
|
||||
// @Override
|
||||
// public synchronized void addPanelHandler(XI5250PanelHandler panel) {
|
||||
// if (panel instanceof AutoLogonHandler) {
|
||||
// if (ivAutoLogonHandler != null)
|
||||
// throw new IllegalArgumentException("Handler already setted");
|
||||
// ivAutoLogonHandler = (AutoLogonHandler)panel;
|
||||
// return;
|
||||
// }
|
||||
// if (ivHandler != null)
|
||||
// throw new IllegalArgumentException("Handler already setted");
|
||||
// ivHandler = panel;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// protected synchronized XI5250PanelHandler getCurrentPanelHandler() {
|
||||
// return (ivAutoLogonHandler != null && ivAutoLogonHandler.detailedTest()) ? ivAutoLogonHandler : ivHandler;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public synchronized void removePanelHandler(XI5250PanelHandler panel) {
|
||||
// if (ivHandler != panel)
|
||||
// throw new IllegalArgumentException("Not the registered handler " + panel);
|
||||
// ivHandler = null;
|
||||
// }
|
||||
// }
|
||||
|
||||
//////
|
||||
|
||||
|
|
@ -300,48 +294,48 @@ public class Main {
|
|||
|
||||
//////
|
||||
|
||||
private static class AutoLogonHandler extends XI5250PanelHandler {
|
||||
|
||||
private final LogonInfo ivLogonInfo;
|
||||
private boolean ivLoggedOn;
|
||||
|
||||
public AutoLogonHandler(XI5250PanelsDispatcher aPanelDisp, LogonInfo info) {
|
||||
super(aPanelDisp);
|
||||
ivLogonInfo = info;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean detailedTest() {
|
||||
if (ivLoggedOn)
|
||||
return false;
|
||||
// I'm expecting xx fields in the logon panel
|
||||
if (getFields().size() != ivLogonInfo.fieldsCount)
|
||||
return false;
|
||||
// Is there the user id field ?
|
||||
if (!checkField(getFieldNextTo(ivLogonInfo.userLabel), 10))
|
||||
return false;
|
||||
// Is there the password field ?
|
||||
if (!checkField(getFieldNextTo(ivLogonInfo.passwdLabel), 10))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void start() {
|
||||
ivLoggedOn = true;
|
||||
// Start logon panel processing
|
||||
XI5250Field userField = getFieldNextTo(ivLogonInfo.userLabel);
|
||||
XI5250Field passwdField = getFieldNextTo(ivLogonInfo.passwdLabel);
|
||||
userField.setString(ivLogonInfo.user); // Your user id
|
||||
passwdField.setString(ivLogonInfo.passwd); // Your password
|
||||
// Simulate the user ENTER key pressed
|
||||
getEmulator().processRawKeyEvent(
|
||||
new KeyEvent(getEmulator(), KeyEvent.KEY_PRESSED,
|
||||
0, 0, KeyEvent.VK_ENTER, KeyEvent.CHAR_UNDEFINED));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void stop() {
|
||||
}
|
||||
}
|
||||
// private static class AutoLogonHandler extends XI5250PanelHandler {
|
||||
//
|
||||
// private final LogonInfo ivLogonInfo;
|
||||
// private boolean ivLoggedOn;
|
||||
//
|
||||
// public AutoLogonHandler(XI5250PanelsDispatcher aPanelDisp, LogonInfo info) {
|
||||
// super(aPanelDisp);
|
||||
// ivLogonInfo = info;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// protected boolean detailedTest() {
|
||||
// if (ivLoggedOn)
|
||||
// return false;
|
||||
// // I'm expecting xx fields in the logon panel
|
||||
// if (getFields().size() != ivLogonInfo.fieldsCount)
|
||||
// return false;
|
||||
// // Is there the user id field ?
|
||||
// if (!checkField(getFieldNextTo(ivLogonInfo.userLabel), 10))
|
||||
// return false;
|
||||
// // Is there the password field ?
|
||||
// if (!checkField(getFieldNextTo(ivLogonInfo.passwdLabel), 10))
|
||||
// return false;
|
||||
// return true;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// protected void start() {
|
||||
// ivLoggedOn = true;
|
||||
// // Start logon panel processing
|
||||
// XI5250Field userField = getFieldNextTo(ivLogonInfo.userLabel);
|
||||
// XI5250Field passwdField = getFieldNextTo(ivLogonInfo.passwdLabel);
|
||||
// userField.setString(ivLogonInfo.user); // Your user id
|
||||
// passwdField.setString(ivLogonInfo.passwd); // Your password
|
||||
// // Simulate the user ENTER key pressed
|
||||
// getEmulator().processRawKeyEvent(
|
||||
// new KeyEvent(getEmulator(), KeyEvent.KEY_PRESSED,
|
||||
// 0, 0, KeyEvent.VK_ENTER, KeyEvent.CHAR_UNDEFINED));
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// protected void stop() {
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -142,11 +142,7 @@ public class XICrt extends JComponent implements Serializable {
|
|||
fntSize = fontSize;
|
||||
}
|
||||
InputStream is = null;
|
||||
try {
|
||||
is = new FileInputStream("/tmp/x.ttf");
|
||||
} catch (FileNotFoundException ex) {
|
||||
System.err.println("file not found font : " + ex);
|
||||
}
|
||||
is = theClass.getResourceAsStream("/res/ubuntu-mono-regular.ttf");
|
||||
Font font = null;
|
||||
try {
|
||||
System.err.println(" createFont Testing res/" + fontFileName + " ... ");
|
||||
|
|
@ -173,17 +169,11 @@ public class XICrt extends JComponent implements Serializable {
|
|||
setFreeze(true);
|
||||
setOpaque(true);
|
||||
|
||||
/*
|
||||
if (XIUtil.is1dot2)
|
||||
setFont(new Font("Monospaced", Font.PLAIN, MIN_FONT_SIZE));
|
||||
else
|
||||
*/
|
||||
Font inconsolata = loadFontFromResource(XICrt.class, "MonoSpaced", MIN_FONT_SIZE);
|
||||
setFont(inconsolata);
|
||||
//setFont(new Font("Monospaced", Font.PLAIN, MIN_FONT_SIZE));
|
||||
setLayout(null);
|
||||
setCrtBuffer(createCrtBuffer(80, 24));
|
||||
setBackground(Color.red);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -870,8 +860,7 @@ public class XICrt extends JComponent implements Serializable {
|
|||
|
||||
crt.drawString("eccome" + '!', 0, 1);
|
||||
|
||||
crt.setBackground(Color.green);
|
||||
|
||||
crt.setBackground(Color.yellow);
|
||||
|
||||
frm.getContentPane().add(crt);
|
||||
frm.setBounds(0, 0, 600, 500);
|
||||
|
|
|
|||
BIN
res/Monospaced
Normal file
BIN
res/Monospaced
Normal file
Binary file not shown.
BIN
res/ubuntu-mono-regular.ttf
Normal file
BIN
res/ubuntu-mono-regular.ttf
Normal file
Binary file not shown.
Loading…
Add table
Reference in a new issue