Index: lams_central/conf/language/lams/ApplicationResources.properties =================================================================== RCS file: /usr/local/cvsroot/lams_central/conf/language/lams/ApplicationResources.properties,v diff -u -r1.138.2.13 -r1.138.2.14 --- lams_central/conf/language/lams/ApplicationResources.properties 11 Sep 2015 16:08:12 -0000 1.138.2.13 +++ lams_central/conf/language/lams/ApplicationResources.properties 12 Dec 2015 18:28:52 -0000 1.138.2.14 @@ -652,5 +652,14 @@ authoring.fla.liveedit.readonly.remove.child.error =The activity can not be removed. It has read-only child activities. authoring.fla.liveedit.readonly.remove.transition.error =The transition can not be removed. It is read-only. +ckeditor.math.greek =Greek +ckeditor.math.uppercase =uppercase +ckeditor.math.misc =misc +ckeditor.math.binary =binary +ckeditor.math.large =large +ckeditor.math.relations =relations +ckeditor.math.negatedrelations =negated
relations +ckeditor.math.arrows =arrows +ckeditor.math.combining =combining #======= End labels: Exported 438 labels for en AU ===== Index: lams_central/src/java/org/lamsfoundation/lams/web/JlatexmathServlet.java =================================================================== RCS file: /usr/local/cvsroot/lams_central/src/java/org/lamsfoundation/lams/web/JlatexmathServlet.java,v diff -u -r1.2.2.2 -r1.2.2.3 --- lams_central/src/java/org/lamsfoundation/lams/web/JlatexmathServlet.java 24 Sep 2015 16:36:42 -0000 1.2.2.2 +++ lams_central/src/java/org/lamsfoundation/lams/web/JlatexmathServlet.java 12 Dec 2015 18:28:52 -0000 1.2.2.3 @@ -18,9 +18,9 @@ * * http://www.gnu.org/licenses/gpl.txt * **************************************************************** - */ - -/* $Id$ */ + */ + +/* $Id$ */ package org.lamsfoundation.lams.web; import java.awt.AlphaComposite; @@ -37,7 +37,9 @@ import javax.swing.JLabel; import org.apache.commons.lang.StringUtils; +import org.apache.log4j.Logger; import org.lamsfoundation.lams.util.WebUtil; +import org.scilab.forge.jlatexmath.ParseException; import org.scilab.forge.jlatexmath.TeXConstants; import org.scilab.forge.jlatexmath.TeXFormula; import org.scilab.forge.jlatexmath.TeXIcon; @@ -49,46 +51,65 @@ * @web:servlet-mapping url-pattern="/servlet/jlatexmath" */ public class JlatexmathServlet extends HttpServlet { - + + private static Logger log = Logger.getLogger(JlatexmathServlet.class); + @Override public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { - + String formulaParam = request.getParameter("formula"); if (StringUtils.isBlank(formulaParam)) { return; } - + Integer fontSize = WebUtil.readIntParam(request, "fontSize", true); if (fontSize == null) { fontSize = 20; } - - TeXFormula formula = new TeXFormula(formulaParam); - TeXIcon icon = formula.new TeXIconBuilder().setStyle(TeXConstants.STYLE_DISPLAY) - .setSize(fontSize) - .setWidth(TeXConstants.UNIT_PIXEL, 256f, TeXConstants.ALIGN_CENTER) - .setIsMaxWidth(true).setInterLineSpacing(TeXConstants.UNIT_PIXEL, 20f) - .build(); - -// TeXFormula fomule = new TeXFormula(formula); -// TeXIcon ti = fomule.createTeXIcon(TeXConstants.STYLE_DISPLAY, 40); - BufferedImage b = new BufferedImage(icon.getIconWidth(), icon.getIconHeight(), BufferedImage.TYPE_INT_ARGB); -// Color transparent = new Color(0, true); -// ((Graphics2D)b.getGraphics()).setBackground(transparent); -// b.getGraphics().clearRect(0, 0, icon.getIconWidth(), icon.getIconHeight()); - - ((Graphics2D)b.getGraphics()).setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.5F)); + + TeXFormula formula = null; + try { + formula = new TeXFormula(formulaParam); + } catch (ParseException e) { + // don't throw a full-blown exception whenever an user makes a mistake in the formula + if (JlatexmathServlet.log.isTraceEnabled()) { + JlatexmathServlet.log.trace(e.getMessage()); + } + return; + } + + TeXIcon icon = formula.new TeXIconBuilder().setStyle(TeXConstants.STYLE_DISPLAY).setSize(fontSize) + .setWidth(TeXConstants.UNIT_PIXEL, 256f, TeXConstants.ALIGN_CENTER).setIsMaxWidth(true) + .setInterLineSpacing(TeXConstants.UNIT_PIXEL, 20f).build(); + + BufferedImage b = null; + // TeXFormula fomule = new TeXFormula(formula); + // TeXIcon ti = fomule.createTeXIcon(TeXConstants.STYLE_DISPLAY, 40); + try { + b = new BufferedImage(icon.getIconWidth(), icon.getIconHeight(), BufferedImage.TYPE_INT_ARGB); + } catch (IllegalArgumentException e) { + // don't throw a full-blown exception whenever an user makes a mistake in the formula + if (JlatexmathServlet.log.isTraceEnabled()) { + JlatexmathServlet.log.trace(e.getMessage()); + } + return; + } + // Color transparent = new Color(0, true); + // ((Graphics2D)b.getGraphics()).setBackground(transparent); + // b.getGraphics().clearRect(0, 0, icon.getIconWidth(), icon.getIconHeight()); + + ((Graphics2D) b.getGraphics()).setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.5F)); icon.paintIcon(new JLabel(), b.getGraphics(), 0, 0); - + response.setContentType("image/png"); OutputStream out = response.getOutputStream(); ImageIO.write(b, "png", out); out.close(); } @Override - protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, - IOException { + protected void doPost(HttpServletRequest request, HttpServletResponse response) + throws ServletException, IOException { doGet(request, response); } } Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `lams_central/web/ckeditor/plugins/jlatexmath/buttons.css'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `lams_central/web/ckeditor/plugins/jlatexmath/buttons.js'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.2.1 refers to a dead (removed) revision in file `lams_central/web/ckeditor/plugins/jlatexmath/buttons.jsp'. Fisheye: No comparison available. Pass `N' to diff? Index: lams_central/web/ckeditor/plugins/jlatexmath/jlatexmath.jsp =================================================================== RCS file: /usr/local/cvsroot/lams_central/web/ckeditor/plugins/jlatexmath/jlatexmath.jsp,v diff -u -r1.2.2.2 -r1.2.2.3 --- lams_central/web/ckeditor/plugins/jlatexmath/jlatexmath.jsp 24 Sep 2015 16:36:41 -0000 1.2.2.2 +++ lams_central/web/ckeditor/plugins/jlatexmath/jlatexmath.jsp 12 Dec 2015 18:28:52 -0000 1.2.2.3 @@ -14,6 +14,13 @@ + + + + + + +