Skip to content

Commit

Permalink
Include SourceCodePro as default font
Browse files Browse the repository at this point in the history
  • Loading branch information
moritzfl committed Feb 7, 2019
1 parent 24ba7be commit effcb09
Show file tree
Hide file tree
Showing 3 changed files with 142 additions and 156 deletions.
272 changes: 119 additions & 153 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -1,154 +1,120 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>


<groupId>com.github.moritzfl</groupId>
<artifactId>mathematicallatexhelper</artifactId>
<version>1.3</version>

<name>mathematicallatexhelper</name>

<prerequisites>
<maven>3</maven>
</prerequisites>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<mainClass>de.moritzf.latexhelper.Main</mainClass>
</properties>


<repositories>
<repository>
<id>maven-central</id>
<url>http://central.maven.org/maven2/</url>
</repository>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>

<dependencies>
<!-- https://mvnrepository.com/artifact/org.scilab.forge/jlatexmath -->
<dependency>
<groupId>org.scilab.forge</groupId>
<artifactId>jlatexmath</artifactId>
<version>1.0.6</version>
</dependency>
</dependencies>

<build>
<sourceDirectory>src/main/java</sourceDirectory>
<resources>
<resource>
<directory>src/main/resources</directory>
</resource>
<resource>
<directory>target/site/generated-resources</directory>
</resource>
</resources>
<plugins>
<plugin>
<groupId>sh.tak.appbundler</groupId>
<artifactId>appbundle-maven-plugin</artifactId>
<version>1.2.0</version>
<configuration>
<mainClass>${mainClass}</mainClass>
<iconFile>icon.icns</iconFile>
<generateDiskImageFile>true</generateDiskImageFile>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>bundle</goal>
</goals>
</execution>
</executions>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.1.0</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
</execution>
</executions>
<configuration>
<filters>
<filter>
<artifact>*:*</artifact>
<excludes>
<exclude>META-INF/*.SF</exclude>
<exclude>META-INF/*.DSA</exclude>
<exclude>META-INF/*.RSA</exclude>
</excludes>
</filter>
</filters>
<shadedArtifactAttached>true</shadedArtifactAttached>
<shadedClassifierName>shaded</shadedClassifierName>
<transformers>
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>${mainClass}</mainClass>
</transformer>
</transformers>
</configuration>
</plugin>

<plugin>
<groupId>com.akathist.maven.plugins.launch4j</groupId>
<artifactId>launch4j-maven-plugin</artifactId>
<version>1.7.21</version>
<executions>
<execution>
<id>l4j-clui</id>
<phase>package</phase>
<goals>
<goal>launch4j</goal>
</goals>
<configuration>
<headerType>gui</headerType>
<jar>${project.build.directory}/${project.name}-${project.version}-shaded.jar</jar>
<outfile>${project.build.directory}/${project.name}-${project.version}.exe</outfile>
<downloadUrl>http://java.com/download</downloadUrl>
<classPath>
<mainClass>${mainClass}</mainClass>
<preCp>anything</preCp>
</classPath>
<icon>src/main/resources/icon.ico</icon>
<jre>
<minVersion>${maven.compiler.target}.0</minVersion>
</jre>
<versionInfo>
<fileVersion>1.0.0.0</fileVersion>
<txtFileVersion>${project.version}</txtFileVersion>
<fileDescription>${project.name}</fileDescription>
<copyright>2017 Moritz Flöter</copyright>
<productVersion>1.0.0.0</productVersion>
<txtProductVersion>1.0.0.0</txtProductVersion>
<productName>${project.name}</productName>
<companyName>moritzf.de</companyName>
<internalName>${project.name}</internalName>
<originalFilename>original.exe</originalFilename>
</versionInfo>
</configuration>
</execution>
</executions>
</plugin>
</plugins>

</build>


<?xml version="1.0" encoding="utf-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.github.moritzfl</groupId>
<artifactId>mathematicallatexhelper</artifactId>
<version>1.4</version>
<name>mathematicallatexhelper</name>
<prerequisites>
<maven>3</maven>
</prerequisites>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<mainClass>de.moritzf.latexhelper.Main</mainClass>
</properties>
<repositories>
<repository>
<id>maven-central</id>
<url>http://central.maven.org/maven2/</url>
</repository>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
<dependencies>
<!-- https://mvnrepository.com/artifact/org.scilab.forge/jlatexmath -->
<dependency>
<groupId>org.scilab.forge</groupId>
<artifactId>jlatexmath</artifactId>
<version>1.0.6</version>
</dependency>
</dependencies>
<build>
<sourceDirectory>src/main/java</sourceDirectory>
<resources>
<resource>
<directory>src/main/resources</directory>
</resource>
<resource>
<directory>target/site/generated-resources</directory>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.1.0</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
</execution>
</executions>
<configuration>
<filters>
<filter>
<artifact>*:*</artifact>
<excludes>
<exclude>META-INF/*.SF</exclude>
<exclude>META-INF/*.DSA</exclude>
<exclude>META-INF/*.RSA</exclude>
</excludes>
</filter>
</filters>
<shadedArtifactAttached>true</shadedArtifactAttached>
<shadedClassifierName>shaded</shadedClassifierName>
<transformers>
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>${mainClass}</mainClass>
</transformer>
</transformers>
</configuration>
</plugin>
<plugin>
<groupId>com.akathist.maven.plugins.launch4j</groupId>
<artifactId>launch4j-maven-plugin</artifactId>
<version>1.7.21</version>
<executions>
<execution>
<id>l4j-clui</id>
<phase>package</phase>
<goals>
<goal>launch4j</goal>
</goals>
<configuration>
<headerType>gui</headerType>
<jar>${project.build.directory}/${project.name}-${project.version}-shaded.jar</jar>
<outfile>${project.build.directory}/${project.name}-${project.version}.exe</outfile>
<downloadUrl>http://java.com/download</downloadUrl>
<classPath>
<mainClass>${mainClass}</mainClass>
<preCp>anything</preCp>
</classPath>
<icon>src/main/resources/icon.ico</icon>
<jre>
<minVersion>${maven.compiler.target}.0</minVersion>
</jre>
<versionInfo>
<fileVersion>1.0.0.0</fileVersion>
<txtFileVersion>${project.version}</txtFileVersion>
<fileDescription>${project.name}</fileDescription>
<copyright>2017 Moritz Flöter</copyright>
<productVersion>1.0.0.0</productVersion>
<txtProductVersion>1.0.0.0</txtProductVersion>
<productName>${project.name}</productName>
<companyName>moritzf.de</companyName>
<internalName>${project.name}</internalName>
<originalFilename>original.exe</originalFilename>
</versionInfo>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
22 changes: 20 additions & 2 deletions src/main/java/de/moritzf/latexhelper/Gui.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyEvent;
import java.io.IOException;
import java.io.InputStream;
import java.util.logging.Level;
import java.util.logging.Logger;

import javax.swing.*;
import javax.swing.event.DocumentEvent;
Expand Down Expand Up @@ -46,7 +50,7 @@ public class Gui extends JFrame implements ActionListener, DocumentListener {
/**
* The latex source.
*/
private JTextArea latexSource = new JTextArea();
private JTextArea latexSource;

private UndoManager undoManager;

Expand All @@ -65,6 +69,19 @@ public class Gui extends JFrame implements ActionListener, DocumentListener {
*/
private JLabel drawingArea = new JLabel("");


private static Font getFontForTextArea() {
try {
InputStream is = Gui.class.getResourceAsStream("SourceCodeVariable-Roman.ttf");
Font font = Font.createFont(Font.TRUETYPE_FONT, is);
font = font.deriveFont(Font.PLAIN, 16);
return font;
} catch (FontFormatException | IOException ex) {
Logger.getLogger(Gui.class.getName()).log(Level.SEVERE, "Font SourceCodePro not available", ex);
return new Font("Courier", Font.PLAIN, 16);
}
}

/**
* Instantiates a new gui.
*/
Expand All @@ -73,7 +90,8 @@ public Gui() {
Container content = this.getContentPane();
content.setLayout(new GridLayout(2, 1));
this.latexSource = new JTextArea();
this.latexSource.setFont(new Font("Courier", Font.PLAIN, 14));

this.latexSource.setFont(getFontForTextArea());

initUndoRedoFunctionality();

Expand Down
4 changes: 3 additions & 1 deletion src/main/java/de/moritzf/latexhelper/WindowFunctions.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
import java.awt.Rectangle;
import java.awt.Window;
import java.lang.reflect.Method;
import java.util.logging.Level;
import java.util.logging.Logger;

import javax.swing.UIManager;

Expand Down Expand Up @@ -94,7 +96,7 @@ public static void enableOSXFullscreen(Window window) {
Method method = util.getMethod("setWindowCanFullScreen", params);
method.invoke(util, window, true);
} catch (Exception e) {
System.out.println("OSX-Fullscreen-Mode not available");
Logger.getLogger(Gui.class.getName()).log(Level.SEVERE, "Could not enable OSX-Fullscreen", e);
}
}

Expand Down

0 comments on commit effcb09

Please sign in to comment.