|
@@ -312,6 +312,8 @@ public class CWatermarkView extends View {
|
|
|
|
|
|
private CPDFTextAttribute.FontNameHelper.FontType fontType = CPDFTextAttribute.FontNameHelper.FontType.Helvetica;
|
|
private CPDFTextAttribute.FontNameHelper.FontType fontType = CPDFTextAttribute.FontNameHelper.FontType.Helvetica;
|
|
|
|
|
|
|
|
+ private String outFamilyName;
|
|
|
|
+
|
|
private boolean isBold = false;
|
|
private boolean isBold = false;
|
|
|
|
|
|
private boolean isItalic = false;
|
|
private boolean isItalic = false;
|
|
@@ -533,7 +535,11 @@ public class CWatermarkView extends View {
|
|
* @param bold
|
|
* @param bold
|
|
*/
|
|
*/
|
|
public void setBold(boolean bold) {
|
|
public void setBold(boolean bold) {
|
|
- setTypeface(getFontType(), bold, isItalic());
|
|
|
|
|
|
+ if (!TextUtils.isEmpty(outFamilyName)){
|
|
|
|
+ setTypeface(outFamilyName, bold, isItalic());
|
|
|
|
+ }else {
|
|
|
|
+ setTypeface(getFontType(), bold, isItalic());
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -542,7 +548,11 @@ public class CWatermarkView extends View {
|
|
* @param italic
|
|
* @param italic
|
|
*/
|
|
*/
|
|
public void setItalic(boolean italic) {
|
|
public void setItalic(boolean italic) {
|
|
- setTypeface(getFontType(), isBold(), italic);
|
|
|
|
|
|
+ if (!TextUtils.isEmpty(outFamilyName)){
|
|
|
|
+ setTypeface(outFamilyName, isBold(), italic);
|
|
|
|
+ }else {
|
|
|
|
+ setTypeface(getFontType(), isBold(), italic);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -561,6 +571,7 @@ public class CWatermarkView extends View {
|
|
this.typeface = typeface;
|
|
this.typeface = typeface;
|
|
this.fontType = fontType;
|
|
this.fontType = fontType;
|
|
this.isBold = isBold;
|
|
this.isBold = isBold;
|
|
|
|
+ this.outFamilyName = "";
|
|
this.isItalic = isItalic;
|
|
this.isItalic = isItalic;
|
|
txtPaint.setTypeface(this.typeface);
|
|
txtPaint.setTypeface(this.typeface);
|
|
calculateBaseLine();
|
|
calculateBaseLine();
|
|
@@ -568,10 +579,41 @@ public class CWatermarkView extends View {
|
|
transformDraw();
|
|
transformDraw();
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ public void setTypeface(String outFamilyName, boolean isBold, boolean isItalic) {
|
|
|
|
+ String psName = CPDFTextAttribute.FontNameHelper.obtainOutFontName(outFamilyName, isBold, isItalic);
|
|
|
|
+ Typeface typeface = CPDFTextAttribute.FontNameHelper.getOutTypeface(getContext(), psName);
|
|
|
|
+ this.typeface = typeface;
|
|
|
|
+ this.fontType = CPDFTextAttribute.FontNameHelper.FontType.Unknown;
|
|
|
|
+ this.outFamilyName = outFamilyName;
|
|
|
|
+ this.isBold = isBold;
|
|
|
|
+ this.isItalic = isItalic;
|
|
|
|
+ txtPaint.setTypeface(this.typeface);
|
|
|
|
+ calculateBaseLine();
|
|
|
|
+ calculateDrawToCenterDistance();
|
|
|
|
+ transformDraw();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
public CPDFTextAttribute.FontNameHelper.FontType getFontType() {
|
|
public CPDFTextAttribute.FontNameHelper.FontType getFontType() {
|
|
return fontType;
|
|
return fontType;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ public String getOutFamilyName() {
|
|
|
|
+ return outFamilyName;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public String getFontName(){
|
|
|
|
+ if (!TextUtils.isEmpty(outFamilyName)){
|
|
|
|
+ return CPDFTextAttribute.FontNameHelper.obtainOutFontName(
|
|
|
|
+ outFamilyName, isBold(), isItalic()
|
|
|
|
+ );
|
|
|
|
+ }else {
|
|
|
|
+ return CPDFTextAttribute.FontNameHelper.obtainFontName(
|
|
|
|
+ fontType, isBold(), isItalic()
|
|
|
|
+ );
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 设置旋转图
|
|
* 设置旋转图
|
|
*
|
|
*
|