Skip to content

Commit

Permalink
PDF spacing adjustments and Letter portrait params
Browse files Browse the repository at this point in the history
  • Loading branch information
tdumitrescu committed Aug 20, 2016
1 parent e2956f1 commit 9d9c39a
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 11 deletions.
18 changes: 12 additions & 6 deletions src/Gfx/PDFCreator.java
Expand Up @@ -161,7 +161,7 @@ PrintParams createPrintParams(ArrayList[] renderer)

PrintParams createPrintParams(ScorePageRenderer renderer)
{
return new PrintParams(PrintParams.DEFAULT_A4ScorePortrait);
return new PrintParams(PrintParams.DEFAULT_LetterScorePortrait);
}

/*------------------------------------------------------------------------
Expand Down Expand Up @@ -203,8 +203,14 @@ PdfContentByte initPDF(OutputStream outs)
);
StaffNameFont=BaseFont.createFont(BaseFont.HELVETICA,BaseFont.CP1252,BaseFont.NOT_EMBEDDED);
ScoreAnnotationFont=BaseFont.createFont(BaseFont.HELVETICA,BaseFont.CP1252,BaseFont.NOT_EMBEDDED);
TitleFont=BaseFont.createFont(BaseFont.TIMES_ITALIC,BaseFont.CP1252,BaseFont.NOT_EMBEDDED);
SubtitleFont=BaseFont.createFont(BaseFont.TIMES_ROMAN,BaseFont.CP1252,BaseFont.NOT_EMBEDDED);
TitleFont=BaseFont.createFont(
Util.AppContext.BaseDataDir+MusicFont.FontRelativeDir+"FreeSerif.ttf",
BaseFont.IDENTITY_H,BaseFont.EMBEDDED
);
SubtitleFont=BaseFont.createFont(
Util.AppContext.BaseDataDir+MusicFont.FontRelativeDir+"FreeSerif.ttf",
BaseFont.IDENTITY_H,BaseFont.EMBEDDED
);
}
catch (Exception e)
{
Expand Down Expand Up @@ -446,7 +452,7 @@ void drawScorePage(int curPageNum,ScorePageRenderer renderedPages,PdfContentByte
void drawScoreTitle(PdfContentByte cb)
{
float baseY=PP.PAGEYSIZE-PP.YMARGIN,
subtextYadd=TitleFont.getAscentPoint(musicData.getTitle(),PP.TitleFONTSIZE)*1.5f;
subtextYadd=TitleFont.getAscentPoint(musicData.getTitle(),PP.TitleFONTSIZE);

cb.setFontAndSize(TitleFont,PP.TitleFONTSIZE);

Expand Down Expand Up @@ -486,7 +492,7 @@ void drawFooter(PdfContentByte cb)
cb.setFontAndSize(PlainFont,PP.PlainFONTSIZE);
cb.showTextAligned(PdfContentByte.ALIGN_RIGHT,
CMME_PDF_INFO_STRING,
PP.PAGEXSIZE-PP.XMARGIN,PP.YMARGIN,0);
PP.PAGEXSIZE-PP.XMARGIN,PP.YMARGIN-PP.STAFFYSCALE,0);
}

/*------------------------------------------------------------------------
Expand Down Expand Up @@ -988,7 +994,7 @@ void drawSystemBarlines(PdfContentByte cb,ScorePageRenderer renderedPages,
{
cb.beginText();
cb.setFontAndSize(PlainFont,PP.PlainFONTSIZE);
cb.setTextMatrix(xloc-PP.STAFFYSCALE,yloc+PP.STAFFYSCALE*3);
cb.setTextMatrix(xloc-PP.STAFFYSCALE*2,yloc+PP.STAFFYSCALE*2);
cb.showText(String.valueOf(curSystem.startMeasure+1));
cb.endText();
}
Expand Down
20 changes: 15 additions & 5 deletions src/Gfx/PrintParams.java
Expand Up @@ -32,9 +32,10 @@ public class PrintParams
/*----------------------------------------------------------------------*/
/* Class variables */

public static final int DEFAULT_BookExample1= 0,
DEFAULT_A4ScorePortrait=1,
DEFAULT_A4PartLandscape=2;
public static final int DEFAULT_BookExample1= 0,
DEFAULT_A4ScorePortrait= 1,
DEFAULT_A4PartLandscape= 2,
DEFAULT_LetterScorePortrait=3;

private static final PrintParams DEFAULTS[]=new PrintParams[]
{
Expand All @@ -54,7 +55,7 @@ public class PrintParams
.4336f,3, /* STAFFLINEWIDTH, LINEXADJUST */
4.668f,50f, /* STAFFYSCALE, STAFFYSPACE */
.75f, /* STEMWIDTH */
22,7,9,7,8,24,20), /* [Music|Plain|Text|StaffName|ScoreAnnotation|Title|Subtitle]FONTSIZE */
22,7,10,7,8,24,20), /* [Music|Plain|Text|StaffName|ScoreAnnotation|Title|Subtitle]FONTSIZE */

/* DEFAULT_A4PartLandscape */
new PrintParams(
Expand All @@ -63,7 +64,16 @@ public class PrintParams
.4336f,.2f, /* STAFFLINEWIDTH, LINEXADJUST */
4.668f,50f, /* STAFFYSCALE, STAFFYSPACE */
.75f, /* STEMWIDTH */
22,7,7,7,8,24,20) /* [Music|Plain|Text|StaffName|ScoreAnnotation|Title|Subtitle]FONTSIZE */
22,7,7,7,8,24,20), /* [Music|Plain|Text|StaffName|ScoreAnnotation|Title|Subtitle]FONTSIZE */

/* LetterScorePortrait */
new PrintParams(
8.5f*72,11.0f*72, /* PAGE[X|Y]SIZE (8.5x11") */
0.9f*72,0.9f*72, /* [X|Y]MARGIN */
.4336f,3, /* STAFFLINEWIDTH, LINEXADJUST */
4.668f,50f, /* STAFFYSCALE, STAFFYSPACE */
.75f, /* STEMWIDTH */
22,7,10,7,8,24,20) /* [Music|Plain|Text|StaffName|ScoreAnnotation|Title|Subtitle]FONTSIZE */
};

/*----------------------------------------------------------------------*/
Expand Down

0 comments on commit 9d9c39a

Please sign in to comment.