仿照Microsoft Word,PageStyle的基本屬性:
float width; // 總寬度
float height; // 總高度
float leftMargin; // 左邊距
float rightMargin; // 右邊距float topMargin; // 上邊距
float bottomMargin; // 下邊距float bindingMargin; // 裝訂線寬度
int bindingPosition; // 裝訂位置
設計頁面樣式如下:
Page的有效顯示區域為scaleWidth和scaleHeight:
public float scaleWidth() {
??? return width - leftMargin - rightMargin -
??????? ( bindingPosition==BINDING_LEFT ? bindingMargin : 0.0f );
}
public float scaleHeight() {
??? return height - topMargin - bottomMargin -
??????? ( bindingPosition==BINDING_TOP ? bindingMargin : 0.0f );
}
類似的,段落樣式如下:
int alignment; // 對齊方式
float firstIndent; // 首行縮進
float leftIndent; // 左縮進
float rightIndent; // 右縮進
float rowSpace; // 行距
如圖:
行高是由所在行的最高的一個Glyph決定的,如上圖第三行的高度就是圖片的高度。
行距是預設的常數。
Paragraph的總寬度由頁面屬性scaleWidth決定,總高度無限制,也不必計算。分頁是按照行高而不是Paragraph的高度計算的。
Paragraph的有效寬度scaleWidth的計算:
public float scaleWidth(boolean firstRow) {
??? return this.pstyle.scaleWidth(firstRow);
}
更多文章、技術交流、商務合作、聯系博主
微信掃碼或搜索:z360901061

微信掃一掃加我為好友
QQ號聯系: 360901061
您的支持是博主寫作最大的動力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描下面二維碼支持博主2元、5元、10元、20元等您想捐的金額吧,狠狠點擊下面給點支持吧,站長非常感激您!手機微信長按不能支付解決辦法:請將微信支付二維碼保存到相冊,切換到微信,然后點擊微信右上角掃一掃功能,選擇支付二維碼完成支付。
【本文對您有幫助就好】元
