~ubuntu-branches/debian/sid/latexdraw/sid

« back to all changes in this revision

Viewing changes to latexDraw/figures/Text.java

  • Committer: Bazaar Package Importer
  • Author(s): Stuart Prescott
  • Date: 2009-07-15 23:35:52 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20090715233552-2bblktyf2lmrkyo3
Tags: 2.0.3+1-1
* New upstream release.
* Add additional Recommended packages for new export features.
* Fix typo in long description, with thanks to Kai Weber (Closes: #529195).
* Bump standards to 3.8.2 (no changes).

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
import latexDraw.ui.DrawContainer;
19
19
import latexDraw.ui.LaTeXDrawFrame;
20
20
import latexDraw.ui.components.MagneticGrid;
 
21
import latexDraw.util.LaTeXDrawNumber;
21
22
import latexDraw.util.LaTeXDrawPoint2D;
22
23
 
23
24
 
360
361
        
361
362
        /** The palatino font */
362
363
        public static final TextFont TEXTFONT_PALATINO = new TextFont("Palatino Linotype", "ppl", "T1"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
 
364
 
 
365
        public static final TextFont TEXTFONT_DIALOG = new TextFont("Dialog", "Dialog.plain", "T1"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
363
366
        
364
367
        /** The font used by default */
365
368
        public static final TextFont DEFAULT_TEXTFONT = TEXTFONT_TIMES;
1027
1030
                if(name.equals(TEXTFONT_COURIER.getName()))
1028
1031
                        currentTextFont = TEXTFONT_COURIER;
1029
1032
                else
1030
 
                if(name.equals(TEXTFONT_PALATINO.getName()))
 
1033
                if(name.equals(TEXTFONT_PALATINO.getName()) || name.equals(TEXTFONT_DIALOG.getName()))
1031
1034
                        currentTextFont = TEXTFONT_PALATINO;
1032
1035
                
1033
1036
                updateFont();
1052
1055
                if(fam.equals(TEXTFONT_COURIER.getFamily()))
1053
1056
                        currentTextFont = TEXTFONT_COURIER;
1054
1057
                else
1055
 
                if(fam.equals(TEXTFONT_PALATINO.getFamily()))
 
1058
                if(fam.equals(TEXTFONT_PALATINO.getFamily()) || fam.equals(TEXTFONT_DIALOG.getFamily()))
1056
1059
                        currentTextFont = TEXTFONT_PALATINO;
1057
1060
                
1058
1061
                updateFont();
1258
1261
        {
1259
1262
                if(text==null || text.length()==0) return null;
1260
1263
                
 
1264
                double threshold = 0.001;
1261
1265
                String addBegin="", addEnd="", size="", font=""; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
1262
1266
                LaTeXDrawPoint2D d = drawBorders.getOriginPoint();
1263
1267
                double yGap = 0;
1274
1278
                
1275
1279
                if(rotationAngle%(Math.PI*2)!=0.)
1276
1280
                {
1277
 
                        double angle = -Math.toDegrees(rotationAngle);
1278
 
                        double cx = (gravityCenter.x-d.x)/ppc;
1279
 
                        double cy = (d.y-gravityCenter.y)/ppc;
1280
 
                        double x2 = -Math.cos(-rotationAngle)*cx+
1281
 
                                                Math.sin(-rotationAngle)*cy+cx;
1282
 
                        double y2 =  -Math.sin(-rotationAngle)*cx-
1283
 
                                                Math.cos(-rotationAngle)*cy+cy;
1284
 
                        addBegin +="\\rput{"+(float)angle+ "}("+(float)x2+','+(float)y2+"){"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
 
1281
                        float angle = LaTeXDrawNumber.getCutNumber((float)-Math.toDegrees(rotationAngle), threshold);
 
1282
                        float cx = LaTeXDrawNumber.getCutNumber((float)((gravityCenter.x-d.x)/ppc), threshold);
 
1283
                        float cy = LaTeXDrawNumber.getCutNumber((float)((d.y-gravityCenter.y)/ppc), threshold);
 
1284
                        float x2 = LaTeXDrawNumber.getCutNumber((float)(-Math.cos(-rotationAngle)*cx+
 
1285
                                                Math.sin(-rotationAngle)*cy+cx), threshold);
 
1286
                        float y2 =  LaTeXDrawNumber.getCutNumber((float)(-Math.sin(-rotationAngle)*cx-
 
1287
                                                Math.cos(-rotationAngle)*cy+cy), threshold);
 
1288
                        
 
1289
                        addBegin +="\\rput{"+angle+ "}("+x2+','+y2+"){"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
1285
1290
                        addEnd = "}"; //$NON-NLS-1$
1286
1291
                }
1287
1292