diff --git a/sigIRCv2.jar b/sigIRCv2.jar index 1de24f8..32a29ac 100644 Binary files a/sigIRCv2.jar and b/sigIRCv2.jar differ diff --git a/src/sig/MyPanel.java b/src/sig/MyPanel.java index 6fcffe9..373624a 100644 --- a/src/sig/MyPanel.java +++ b/src/sig/MyPanel.java @@ -37,15 +37,18 @@ import sig.utils.FileUtils; public class MyPanel extends JPanel implements MouseListener, ActionListener, MouseWheelListener, KeyListener, ComponentListener, WindowListener{ //List messages = new ArrayList(); - final public static Font programFont = new Font(sigIRC.messageFont,0,24); - final public static Font userFont = new Font(sigIRC.usernameFont,0,16); - final public static Font smallFont = new Font(sigIRC.touhoumotherConsoleFont,0,12); + public static Font programFont = new Font(sigIRC.messageFont,Font.BOLD,32); + public static Font userFont = new Font(sigIRC.usernameFont,Font.BOLD,16); + public static Font smallFont = new Font(sigIRC.touhoumotherConsoleFont,0,12); final public static Font rabiRibiMoneyDisplayFont = new Font("CP Font",0,16); final public static Font rabiRibiTinyDisplayFont = new Font("CP Font",0,12); public int lastMouseX = 0; public int lastMouseY = 0; public MyPanel() { + programFont = programFont.deriveFont(sigIRC.messageFontSize); + userFont = userFont.deriveFont(sigIRC.usernameFontSize); + smallFont = smallFont.deriveFont(sigIRC.touhoumotherConsoleFontSize); //setBorder(BorderFactory.createLineBorder(Color.black)); addMouseListener(this); addMouseWheelListener(this); diff --git a/src/sig/ScrollingText.java b/src/sig/ScrollingText.java index 91ddc7b..aa405ab 100644 --- a/src/sig/ScrollingText.java +++ b/src/sig/ScrollingText.java @@ -175,7 +175,7 @@ public class ScrollingText { if (isAlive && WithinBounds(x,y,Math.max(TextUtils.calculateStringBoundsFont(username, MyPanel.userFont).getWidth(), TextUtils.calculateStringBoundsFont(message, MyPanel.programFont).getWidth()),Math.max(TextUtils.calculateStringBoundsFont(username, MyPanel.userFont).getHeight(), TextUtils.calculateStringBoundsFont(message, MyPanel.programFont).getHeight()))) { //DrawUtils.drawTextFont(g, MyPanel.userFont, x+8, y+stringHeight-20, Color.GREEN, username); DrawUtils.drawOutlineText(g, MyPanel.userFont, x+8, y+stringHeight-20, 2, userColor, Color.BLACK, username); - DrawUtils.drawOutlineText(g, MyPanel.programFont, x, y+stringHeight, 2, Color.WHITE, Color.BLACK, message); + DrawUtils.drawOutlineText(g, MyPanel.programFont, x, y+stringHeight+5, 1, 3, Color.WHITE, Color.BLACK, message); } } diff --git a/src/sig/sigIRC.java b/src/sig/sigIRC.java index eef455b..a0b89d8 100644 --- a/src/sig/sigIRC.java +++ b/src/sig/sigIRC.java @@ -111,6 +111,9 @@ public class sigIRC{ static String messageFont="Gill Sans Ultra Bold Condensed"; static String usernameFont="GillSansMTStd-Book"; static String touhoumotherConsoleFont="Agency FB Bold"; + static Integer messageFontSize = 24; + static Integer usernameFontSize = 16; + static Integer touhoumotherConsoleFontSize = 12; static boolean touhoumothermodule_enabled=false; static boolean twitchmodule_enabled=true; public static boolean chatlogmodule_enabled=true; @@ -206,6 +209,9 @@ public class sigIRC{ messageFont = config.getProperty("messageFont","Gill Sans Ultra Bold Condensed"); usernameFont = config.getProperty("usernameFont","Segoe UI Semibold"); touhoumotherConsoleFont = config.getProperty("touhoumotherConsoleFont","Agency FB Bold"); + messageFontSize = config.getInteger("messageFontSize",24); + usernameFontSize = config.getInteger("usernameFontSize",16); + touhoumotherConsoleFontSize = config.getInteger("touhouMotherConsoleFontSize",12); touhoumothermodule_enabled = config.getBoolean("Module_touhoumother_Enabled",false); controllermodule_enabled = config.getBoolean("Module_controller_Enabled",false); twitchmodule_enabled = config.getBoolean("Module_twitch_Enabled",true); @@ -616,8 +622,10 @@ public class sigIRC{ authenticated=true; } else if (MessageIsAllowed(line)) { + line = new String(line.getBytes(),"UTF-8"); String filteredMessage = FilterMessage(line); panel.addMessage(filteredMessage); + } } } @@ -625,13 +633,17 @@ public class sigIRC{ private static String FilterMessage(String line) { final String hostcutoff_str = "sigonitori :"; - System.out.println("Original Message: "+line); String username = line.substring(1, line.indexOf("!")); String cutstring = channel+" :"; String message = line.substring(line.indexOf(cutstring)+cutstring.length(), line.length()); if (username.equalsIgnoreCase("jtv")) { message = line.substring(line.indexOf(hostcutoff_str)+hostcutoff_str.length(), line.length()); } + /*if (message.length()>0) { + //message = "\uac00\uac01\uac02\u1100\u1101\u1102\u1117 1234567890 "; + System.out.println(message); + }*/ + System.out.println(username+": "+ message); return username+": "+ message; } diff --git a/src/sig/utils/DrawUtils.java b/src/sig/utils/DrawUtils.java index 684f3b3..d0f6211 100644 --- a/src/sig/utils/DrawUtils.java +++ b/src/sig/utils/DrawUtils.java @@ -21,37 +21,41 @@ import sig.MyPanel; public class DrawUtils { public static void drawOutlineText(Graphics g, Font font, double x, double y, int outline_size, Color text_color, Color shadow_color, String message) { - drawOutlineText(g,font,x,y,0,0,outline_size,text_color,shadow_color,message); + drawOutlineText(g,font,x,y,0,0,1,outline_size,text_color,shadow_color,message); } - static void drawOutlineText(Graphics g, Font font, double x, double y, double xoffset, double yoffset, int outline_size, Color text_color, Color shadow_color, String message) { + public static void drawOutlineText(Graphics g, Font font, double x, double y, int font_thickness, int outline_thickness, Color text_color, Color shadow_color, String message) { + drawOutlineText(g,font,x,y,0,0,font_thickness,outline_thickness,text_color,shadow_color,message); + } + static void drawOutlineText(Graphics g, Font font, double x, double y, double xoffset, double yoffset, int font_thickness, int outline_thickness, Color text_color, Color shadow_color, String message) { AttributedString as = new AttributedString(message); as.addAttribute(TextAttribute.FONT, font); g.setColor(shadow_color); Graphics2D g2 = (Graphics2D) g; - if (message.length()>200) { - g2.setColor(shadow_color); - g2.drawString(as.getIterator(),(int)(x+outline_size+xoffset),(int)(y+outline_size+yoffset)); - } else { - FontRenderContext frc = g2.getFontMetrics(font).getFontRenderContext(); - GlyphVector gv = font.createGlyphVector(frc, message); - Rectangle2D box = gv.getVisualBounds(); - Shape shape = gv.getOutline((int)(x+xoffset),(int)(y+yoffset)); - g2.setClip(shape); - g2.drawString(as.getIterator(),(int)(x+xoffset),(int)(y+yoffset)); - g2.setClip(null); - g2.setStroke(new BasicStroke(outline_size*2)); - g2.setColor(shadow_color); - g2.setRenderingHint( - RenderingHints.KEY_ANTIALIASING, - RenderingHints.VALUE_ANTIALIAS_ON); - g2.draw(shape); - } + FontRenderContext frc = g2.getFontMetrics(font).getFontRenderContext(); + GlyphVector gv = font.createGlyphVector(frc, message); + Shape shape = gv.getOutline((int)(x+xoffset),(int)(y+yoffset)); + g2.setClip(null); + g2.setStroke(new BasicStroke(font_thickness + outline_thickness*2)); + g2.setColor(shadow_color); + g2.setRenderingHint( + RenderingHints.KEY_ANTIALIASING, + RenderingHints.VALUE_ANTIALIAS_ON); + g2.draw(shape); + GlyphVector gv2 = font.createGlyphVector(frc, message); + Shape shape2 = gv2.getOutline((int)(x+xoffset),(int)(y+yoffset)); + g2.setClip(null); + g2.setStroke(new BasicStroke(font_thickness)); + g2.setColor(text_color); + g2.setRenderingHint( + RenderingHints.KEY_ANTIALIASING, + RenderingHints.VALUE_ANTIALIAS_ON); + g2.draw(shape2); g2.setColor(text_color); g2.drawString(as.getIterator(),(int)(x+xoffset),(int)(y+yoffset)); } public static void drawCenteredOutlineText(Graphics g, Font font, double x, double y, int outline_size, Color text_color, Color shadow_color, String message) { Rectangle2D textBounds = TextUtils.calculateStringBoundsFont(message, font); - drawOutlineText(g,font,x,y,-textBounds.getWidth()/2,-textBounds.getHeight()/2,outline_size,text_color,shadow_color,message); + drawOutlineText(g,font,x,y,-textBounds.getWidth()/2,-textBounds.getHeight()/2,1,outline_size,text_color,shadow_color,message); } public static void drawText(Graphics g, double x, double y, Color color, String message) { if (message.length()>0) {