Browse Source

PDFTool(Android) - 新增字体管理功能

liuxiaolong 8 months ago
parent
commit
aa12145121
36 changed files with 915 additions and 840 deletions
  1. BIN
      ComPDFKit_Repo/compdfkit-ui/ComPDFKit-UI.aar
  2. BIN
      ComPDFKit_Repo/compdfkit/ComPDFKit.aar
  3. 1 2
      ComPDFKit_Tools/src/main/AndroidManifest.xml
  4. 38 54
      ComPDFKit_Tools/src/main/java/com/compdfkit/tools/annotation/pdfproperties/pdffreetext/CFreeTextStyleFragment.java
  5. 19 0
      ComPDFKit_Tools/src/main/java/com/compdfkit/tools/annotation/pdfproperties/pdfsignature/CAddSignatureActivity.java
  6. 0 3
      ComPDFKit_Tools/src/main/java/com/compdfkit/tools/common/pdf/CPDFDocumentFragment.java
  7. 0 1
      ComPDFKit_Tools/src/main/java/com/compdfkit/tools/common/utils/CPermissionUtil.java
  8. 123 0
      ComPDFKit_Tools/src/main/java/com/compdfkit/tools/common/views/pdfproperties/font/CFontSpinnerAdapter1.java
  9. 134 0
      ComPDFKit_Tools/src/main/java/com/compdfkit/tools/common/views/pdfproperties/font/CFontStyleSpinnerAdapter.java
  10. 224 0
      ComPDFKit_Tools/src/main/java/com/compdfkit/tools/common/views/pdfproperties/font/CPDFFontView.java
  11. 3 39
      ComPDFKit_Tools/src/main/java/com/compdfkit/tools/common/views/pdfproperties/pdfstyle/manager/provider/CEditSelectionsProvider.java
  12. 11 19
      ComPDFKit_Tools/src/main/java/com/compdfkit/tools/common/views/pdfproperties/pdfstyle/manager/provider/CGlobalStyleProvider.java
  13. 3 7
      ComPDFKit_Tools/src/main/java/com/compdfkit/tools/common/views/pdfproperties/pdfstyle/manager/provider/CSelectedAnnotStyleProvider.java
  14. 10 18
      ComPDFKit_Tools/src/main/java/com/compdfkit/tools/common/views/pdfproperties/pdfstyle/manager/provider/CSelectedFormStyleProvider.java
  15. 29 0
      ComPDFKit_Tools/src/main/java/com/compdfkit/tools/common/views/pdfproperties/pdfstyle/manager/provider/CStyleProvider.java
  16. 8 6
      ComPDFKit_Tools/src/main/java/com/compdfkit/tools/common/views/pdfproperties/preview/CAnnotFreeTextPreviewView.java
  17. 2 1
      ComPDFKit_Tools/src/main/java/com/compdfkit/tools/common/views/pdfproperties/preview/CBasicAnnotPreviewView.java
  18. 2 2
      ComPDFKit_Tools/src/main/java/com/compdfkit/tools/common/views/pdfproperties/preview/CStylePreviewView.java
  19. 28 99
      ComPDFKit_Tools/src/main/java/com/compdfkit/tools/contenteditor/pdfproperties/CEditTextProperFragment.java
  20. 20 52
      ComPDFKit_Tools/src/main/java/com/compdfkit/tools/forms/pdfproperties/pdflistbox/CListBoxStyleFragment.java
  21. 19 53
      ComPDFKit_Tools/src/main/java/com/compdfkit/tools/forms/pdfproperties/pdfpushbutton/CPushButtonStyleFragment.java
  22. 20 48
      ComPDFKit_Tools/src/main/java/com/compdfkit/tools/forms/pdfproperties/pdftextfield/CTextFieldStyleFragment.java
  23. 24 47
      ComPDFKit_Tools/src/main/java/com/compdfkit/tools/security/watermark/pdfproperties/CWatermarkTextStyleFragment.java
  24. 3 10
      ComPDFKit_Tools/src/main/java/com/compdfkit/tools/signature/importcert/create/CPDFSelectDigitalSignatureDialog.java
  25. 26 5
      ComPDFKit_Tools/src/main/res/layout-land/tools_properties_signature_style_add_activity.xml
  26. 72 0
      ComPDFKit_Tools/src/main/res/layout/tools_cpdf_font_view.xml
  27. 7 60
      ComPDFKit_Tools/src/main/res/layout/tools_cpdf_security_watermark_text_style_fragment.xml
  28. 6 61
      ComPDFKit_Tools/src/main/res/layout/tools_edit_text_property_fragment.xml
  29. 20 72
      ComPDFKit_Tools/src/main/res/layout/tools_properties_free_text_style_fragment.xml
  30. 8 59
      ComPDFKit_Tools/src/main/res/layout/tools_properties_list_box_style_fragment.xml
  31. 8 59
      ComPDFKit_Tools/src/main/res/layout/tools_properties_push_button_style_fragment.xml
  32. 21 3
      ComPDFKit_Tools/src/main/res/layout/tools_properties_signature_style_add_activity.xml
  33. 8 59
      ComPDFKit_Tools/src/main/res/layout/tools_properties_text_fields_style_fragment.xml
  34. 5 1
      ComPDFKit_Tools/src/main/res/layout/tools_spinner_list_item.xml
  35. 6 0
      ComPDFKit_Tools/src/main/res/values-zh-rCN/tools_strings.xml
  36. 7 0
      ComPDFKit_Tools/src/main/res/values/tools_strings.xml

BIN
ComPDFKit_Repo/compdfkit-ui/ComPDFKit-UI.aar


BIN
ComPDFKit_Repo/compdfkit/ComPDFKit.aar


+ 1 - 2
ComPDFKit_Tools/src/main/AndroidManifest.xml

@@ -1,6 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>
-<manifest xmlns:android="http://schemas.android.com/apk/res/android"
-    xmlns:tools="http://schemas.android.com/tools">
+<manifest xmlns:android="http://schemas.android.com/apk/res/android">
 
     <uses-permission android:name="android.permission.RECORD_AUDIO" />
     <uses-permission android:name="android.permission.CAMERA" />

+ 38 - 54
ComPDFKit_Tools/src/main/java/com/compdfkit/tools/annotation/pdfproperties/pdffreetext/CFreeTextStyleFragment.java

@@ -1,6 +1,6 @@
 /**
  * Copyright © 2014-2023 PDF Technologies, Inc. All Rights Reserved.
- *
+ * <p>
  * THIS SOURCE CODE AND ANY ACCOMPANYING DOCUMENTATION ARE PROTECTED BY INTERNATIONAL COPYRIGHT LAW
  * AND MAY NOT BE RESOLD OR REDISTRIBUTED. USAGE IS BOUND TO THE ComPDFKit LICENSE AGREEMENT.
  * UNAUTHORIZED REPRODUCTION OR DISTRIBUTION IS SUBJECT TO CIVIL AND CRIMINAL PENALTIES.
@@ -11,12 +11,11 @@ package com.compdfkit.tools.annotation.pdfproperties.pdffreetext;
 
 
 import android.os.Bundle;
+import android.text.TextUtils;
 import android.view.LayoutInflater;
 import android.view.View;
 import android.view.ViewGroup;
-import android.widget.AdapterView;
 import android.widget.LinearLayout;
-import android.widget.Spinner;
 
 import androidx.annotation.NonNull;
 import androidx.annotation.Nullable;
@@ -24,12 +23,13 @@ import androidx.appcompat.widget.AppCompatImageView;
 
 import com.compdfkit.core.annotation.CPDFTextAttribute;
 import com.compdfkit.tools.R;
+import com.compdfkit.tools.common.utils.CLog;
 import com.compdfkit.tools.common.utils.view.colorpicker.CColorPickerFragment;
 import com.compdfkit.tools.common.utils.view.colorpicker.widget.ColorPickerView;
 import com.compdfkit.tools.common.utils.view.sliderbar.CSliderBar;
 import com.compdfkit.tools.common.views.pdfproperties.basic.CBasicPropertiesFragment;
 import com.compdfkit.tools.common.views.pdfproperties.colorlist.ColorListView;
-import com.compdfkit.tools.common.views.pdfproperties.font.CFontSpinnerAdapter;
+import com.compdfkit.tools.common.views.pdfproperties.font.CPDFFontView;
 import com.compdfkit.tools.common.views.pdfproperties.pdfstyle.CAnnotStyle;
 import com.compdfkit.tools.common.views.pdfproperties.pdfstyle.CStyleFragmentDatas;
 import com.compdfkit.tools.common.views.pdfproperties.preview.CStylePreviewView;
@@ -38,7 +38,7 @@ import java.util.ArrayList;
 import java.util.List;
 
 public class CFreeTextStyleFragment extends CBasicPropertiesFragment implements View.OnClickListener,
-        ColorPickerView.COnColorChangeListener,ColorPickerView.COnColorAlphaChangeListener {
+        ColorPickerView.COnColorChangeListener, ColorPickerView.COnColorAlphaChangeListener {
 
     private CStylePreviewView previewView;
 
@@ -46,10 +46,6 @@ public class CFreeTextStyleFragment extends CBasicPropertiesFragment implements
 
     private CSliderBar opacitySliderBar;
 
-    private AppCompatImageView ivFontItalic;
-
-    private AppCompatImageView ivFontBold;
-
     private LinearLayout llAlignment;
 
     private AppCompatImageView ivAlignmentLeft;
@@ -59,8 +55,7 @@ public class CFreeTextStyleFragment extends CBasicPropertiesFragment implements
     private AppCompatImageView ivAlignmentRight;
 
     private CSliderBar fontSizeSliderBar;
-
-    private Spinner fontSpinner;
+    private CPDFFontView fontView;
 
     private List<View> alignmentViews = new ArrayList<>();
 
@@ -71,16 +66,12 @@ public class CFreeTextStyleFragment extends CBasicPropertiesFragment implements
         previewView = rootView.findViewById(R.id.style_preview);
         colorListView = rootView.findViewById(R.id.border_color_list_view);
         opacitySliderBar = rootView.findViewById(R.id.slider_bar);
-        ivFontItalic = rootView.findViewById(R.id.iv_font_italic);
-        ivFontBold = rootView.findViewById(R.id.iv_font_bold);
         llAlignment = rootView.findViewById(R.id.ll_alignment_type);
         ivAlignmentLeft = rootView.findViewById(R.id.iv_alignment_left);
         ivAlignmentCenter = rootView.findViewById(R.id.iv_alignment_center);
         ivAlignmentRight = rootView.findViewById(R.id.iv_alignment_right);
         fontSizeSliderBar = rootView.findViewById(R.id.font_size_slider_bar);
-        fontSpinner = rootView.findViewById(R.id.spinner_font);
-        ivFontItalic.setOnClickListener(this);
-        ivFontBold.setOnClickListener(this);
+        fontView = rootView.findViewById(R.id.font_view);
         ivAlignmentLeft.setOnClickListener(this);
         ivAlignmentCenter.setOnClickListener(this);
         ivAlignmentRight.setOnClickListener(this);
@@ -102,27 +93,16 @@ public class CFreeTextStyleFragment extends CBasicPropertiesFragment implements
             previewView.setFontItalic(annotStyle.isFontItalic());
             previewView.setFontType(annotStyle.getFontType());
 
-            List<CPDFTextAttribute.FontNameHelper.FontType> fontTypes = new ArrayList<>();
-            fontTypes.add(CPDFTextAttribute.FontNameHelper.FontType.Helvetica);
-            fontTypes.add(CPDFTextAttribute.FontNameHelper.FontType.Courier);
-            fontTypes.add(CPDFTextAttribute.FontNameHelper.FontType.Times_Roman);
-            CFontSpinnerAdapter fontSpinnerAdapter = new CFontSpinnerAdapter(getContext(), fontTypes);
-            fontSpinner.setAdapter(fontSpinnerAdapter);
-            switch (annotStyle.getFontType()) {
-                case Courier:
-                    fontSpinner.setSelection(1);
-                    break;
-                case Times_Roman:
-                    fontSpinner.setSelection(2);
-                    break;
-                default:
-                    fontSpinner.setSelection(0);
-                    break;
+            CLog.e("字体", "fontType:" + annotStyle.getFontType().name() + ", externFont: " + annotStyle.getExternFontName() + ", bold:" + annotStyle.isFontBold() + ", italic:" + annotStyle.isFontItalic());
+            if (!TextUtils.isEmpty(annotStyle.getExternFontName())) {
+                fontView.initFont(annotStyle.getExternFontName(), annotStyle.isFontBold(), annotStyle.isFontItalic());
+            } else {
+                fontView.initFont(annotStyle.getFontType().name(), annotStyle.isFontBold(), annotStyle.isFontItalic());
             }
+
             colorListView.setSelectColor(annotStyle.getTextColor());
             opacitySliderBar.setProgress(annotStyle.getTextColorOpacity());
-            ivFontBold.setSelected(annotStyle.isFontBold());
-            ivFontItalic.setSelected(annotStyle.isFontItalic());
+
             switch (annotStyle.getAlignment()) {
                 case LEFT:
                     selectAlignmentView(ivAlignmentLeft);
@@ -141,7 +121,7 @@ public class CFreeTextStyleFragment extends CBasicPropertiesFragment implements
         colorListView.setOnColorSelectListener(this::color);
         colorListView.setColorPickerClickListener(() -> {
             CAnnotStyle cAnnotStyle = viewModel.getStyle();
-            showFragment(CStyleFragmentDatas.colorPicker(), (CColorPickerFragment colorPickerFragment)->{
+            showFragment(CStyleFragmentDatas.colorPicker(), (CColorPickerFragment colorPickerFragment) -> {
                 colorPickerFragment.initColor(cAnnotStyle.getTextColor(), cAnnotStyle.getTextColorOpacity());
                 colorPickerFragment.setColorPickerListener(this);
                 colorPickerFragment.setColorAlphaChangeListener(this);
@@ -154,18 +134,25 @@ public class CFreeTextStyleFragment extends CBasicPropertiesFragment implements
             }
         });
         viewModel.addStyleChangeListener(this);
-        fontSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
+
+        fontView.setFontChangeListener(new CPDFFontView.CFontChangeListener() {
             @Override
-            public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
+            public void font(CPDFTextAttribute.FontNameHelper.FontType fontType, String outFontName) {
                 if (viewModel != null) {
-                    CPDFTextAttribute.FontNameHelper.FontType fontType = (CPDFTextAttribute.FontNameHelper.FontType) fontSpinner.getItemAtPosition(position);
-                    viewModel.getStyle().setFontType(fontType);
+                    if (!TextUtils.isEmpty(outFontName)) {
+                        viewModel.getStyle().setExternFontName(outFontName);
+                    }else {
+                        viewModel.getStyle().setFontType(fontType);
+                    }
                 }
             }
 
             @Override
-            public void onNothingSelected(AdapterView<?> parent) {
-
+            public void fontStyle(boolean bold, boolean italic) {
+                if (viewModel != null){
+                    viewModel.getStyle().setFontBold(bold);
+                    viewModel.getStyle().setFontItalic(italic);
+                }
             }
         });
     }
@@ -186,17 +173,7 @@ public class CFreeTextStyleFragment extends CBasicPropertiesFragment implements
 
     @Override
     public void onClick(View v) {
-        if (v.getId() == R.id.iv_font_bold) {
-            ivFontBold.setSelected(!ivFontBold.isSelected());
-            if (viewModel != null) {
-                viewModel.getStyle().setFontBold(ivFontBold.isSelected());
-            }
-        } else if (v.getId() == R.id.iv_font_italic) {
-            ivFontItalic.setSelected(!ivFontItalic.isSelected());
-            if (viewModel != null) {
-                viewModel.getStyle().setFontItalic(ivFontItalic.isSelected());
-            }
-        } else if (v.getId() == R.id.iv_alignment_left) {
+        if (v.getId() == R.id.iv_alignment_left) {
             selectAlignmentView(ivAlignmentLeft);
             setAlignment(CAnnotStyle.Alignment.LEFT);
         } else if (v.getId() == R.id.iv_alignment_center) {
@@ -208,13 +185,13 @@ public class CFreeTextStyleFragment extends CBasicPropertiesFragment implements
         }
     }
 
-    private void selectAlignmentView(AppCompatImageView alignmentView){
+    private void selectAlignmentView(AppCompatImageView alignmentView) {
         for (View view : alignmentViews) {
             view.setSelected(view == alignmentView);
         }
     }
 
-    private void setAlignment(CAnnotStyle.Alignment alignment){
+    private void setAlignment(CAnnotStyle.Alignment alignment) {
         if (viewModel != null) {
             viewModel.getStyle().setAlignment(alignment);
         }
@@ -251,6 +228,13 @@ public class CFreeTextStyleFragment extends CBasicPropertiesFragment implements
         }
     }
 
+    @Override
+    public void onChangeAnnotExternFontType(String fontName) {
+        if (previewView != null) {
+            previewView.setExternFontType(fontName);
+        }
+    }
+
     @Override
     public void onChangeFontBold(boolean bold) {
         if (previewView != null) {

+ 19 - 0
ComPDFKit_Tools/src/main/java/com/compdfkit/tools/annotation/pdfproperties/pdfsignature/CAddSignatureActivity.java

@@ -39,6 +39,7 @@ import com.compdfkit.tools.common.utils.view.colorpicker.ColorPickerDialogFragme
 import com.compdfkit.tools.common.utils.viewutils.CViewUtils;
 import com.compdfkit.tools.common.views.CToolBar;
 import com.compdfkit.tools.common.views.pdfproperties.colorlist.ColorListView;
+import com.compdfkit.tools.common.views.pdfproperties.font.CPDFFontView;
 import com.compdfkit.tools.common.views.pdfproperties.writing.CPDFSignatureEditView;
 import com.google.android.material.floatingactionbutton.FloatingActionButton;
 
@@ -51,6 +52,8 @@ public class CAddSignatureActivity extends AppCompatActivity implements View.OnC
 
     public static final String EXTRA_SCREEN_ORIENTATION = "extra_screen_orientation";
 
+    public static final String EXTRA_HIDE_TYPEFACE = "extra_hide_typeface";
+
     public static final String RESULT_NONE = "result_none";
 
     private AppCompatImageView ivAddDrawSignature;
@@ -81,10 +84,14 @@ public class CAddSignatureActivity extends AppCompatActivity implements View.OnC
 
     private ConstraintLayout clThickness;
 
+    private CPDFFontView fontView;
+
     private SeekBar sbThickness;
 
     private Uri imageUri;
 
+    private boolean hideTypeface;
+
     @Override
     protected void onCreate(@Nullable Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
@@ -106,6 +113,7 @@ public class CAddSignatureActivity extends AppCompatActivity implements View.OnC
         btnClean = findViewById(R.id.btn_clean);
         clThickness = findViewById(R.id.cl_thickness);
         sbThickness = findViewById(R.id.seek_bar_thickness);
+        fontView = findViewById(R.id.font_view);
         initView();
         initListener();
         switchTab(0);
@@ -177,6 +185,10 @@ public class CAddSignatureActivity extends AppCompatActivity implements View.OnC
 
             }
         });
+        fontView.setTypefaceListener(typeface -> {
+            editText.setTypeface(typeface);
+        });
+
     }
 
     private void initView() {
@@ -189,6 +201,7 @@ public class CAddSignatureActivity extends AppCompatActivity implements View.OnC
             boolean showNoneType = getIntent().getBooleanExtra(EXTRA_SHOW_NONE_TYPE, false);
             ivNone.setVisibility(showNoneType ? View.VISIBLE : View.GONE);
         }
+        hideTypeface = getIntent().getBooleanExtra(EXTRA_HIDE_TYPEFACE, false);
     }
 
     private void switchTab(int selectPosition) {
@@ -206,6 +219,7 @@ public class CAddSignatureActivity extends AppCompatActivity implements View.OnC
                 colorListView.setSelectColor(getSignatureColor());
                 fabAddPic.setVisibility(View.GONE);
                 btnClean.setVisibility(View.VISIBLE);
+                fontView.setVisibility(View.GONE);
                 break;
             case 1:
                 CViewUtils.showKeyboard(editText);
@@ -220,6 +234,9 @@ public class CAddSignatureActivity extends AppCompatActivity implements View.OnC
                 colorListView.setSelectColor(getSignatureColor());
                 fabAddPic.setVisibility(View.GONE);
                 btnClean.setVisibility(View.VISIBLE);
+                if (!hideTypeface) {
+                    fontView.setVisibility(View.VISIBLE);
+                }
                 break;
             default:
                 CViewUtils.hideKeyboard(editText);
@@ -229,6 +246,7 @@ public class CAddSignatureActivity extends AppCompatActivity implements View.OnC
                 writingView.setVisibility(View.GONE);
                 editText.setVisibility(View.GONE);
                 clThickness.setVisibility(View.GONE);
+                fontView.setVisibility(View.GONE);
                 cardViewImport.setVisibility(View.VISIBLE);
                 colorListView.setVisibility(View.INVISIBLE);
                 fabAddPic.setVisibility(View.VISIBLE);
@@ -280,6 +298,7 @@ public class CAddSignatureActivity extends AppCompatActivity implements View.OnC
                 savePath = CSignatureDatas.saveSignatureBitmap(this, resultBitmap);
             } else if (ivAddTextSignature.isSelected()) {
                 if (editText.getText() != null && editText.getText().length() > 0) {
+                    editText.setDrawingCacheQuality(View.DRAWING_CACHE_QUALITY_HIGH);
                     editText.buildDrawingCache();
                     Bitmap bitmap = Bitmap.createBitmap(editText.getDrawingCache());
                     Bitmap resultBitmap = CBitmapUtil.cropTransparent(bitmap);

+ 0 - 3
ComPDFKit_Tools/src/main/java/com/compdfkit/tools/common/pdf/CPDFDocumentFragment.java

@@ -23,13 +23,11 @@ import android.net.Uri;
 import android.os.Build;
 import android.os.Bundle;
 import android.os.Environment;
-import android.provider.Settings;
 import android.text.TextUtils;
 import android.view.LayoutInflater;
 import android.view.View;
 import android.view.ViewGroup;
 import android.widget.FrameLayout;
-import android.widget.Toast;
 
 import androidx.activity.OnBackPressedCallback;
 import androidx.activity.result.ActivityResultLauncher;
@@ -45,7 +43,6 @@ import com.compdfkit.core.document.CPDFDocument;
 import com.compdfkit.core.edit.CPDFEditManager;
 import com.compdfkit.core.edit.CPDFEditPage;
 import com.compdfkit.core.page.CPDFPage;
-import com.compdfkit.tools.BuildConfig;
 import com.compdfkit.tools.R;
 import com.compdfkit.tools.annotation.pdfannotationbar.CAnnotationToolbar;
 import com.compdfkit.tools.annotation.pdfproperties.pdflnk.CInkCtrlView;

+ 0 - 1
ComPDFKit_Tools/src/main/java/com/compdfkit/tools/common/utils/CPermissionUtil.java

@@ -20,7 +20,6 @@ import android.net.Uri;
 import android.os.Build;
 import android.os.Environment;
 import android.provider.Settings;
-import android.util.Log;
 
 import androidx.core.app.ActivityCompat;
 import androidx.core.content.ContextCompat;

+ 123 - 0
ComPDFKit_Tools/src/main/java/com/compdfkit/tools/common/views/pdfproperties/font/CFontSpinnerAdapter1.java

@@ -0,0 +1,123 @@
+/**
+ * Copyright © 2014-2023 PDF Technologies, Inc. All Rights Reserved.
+ * <p>
+ * THIS SOURCE CODE AND ANY ACCOMPANYING DOCUMENTATION ARE PROTECTED BY INTERNATIONAL COPYRIGHT LAW
+ * AND MAY NOT BE RESOLD OR REDISTRIBUTED. USAGE IS BOUND TO THE ComPDFKit LICENSE AGREEMENT.
+ * UNAUTHORIZED REPRODUCTION OR DISTRIBUTION IS SUBJECT TO CIVIL AND CRIMINAL PENALTIES.
+ * This notice may not be removed from this file.
+ */
+
+package com.compdfkit.tools.common.views.pdfproperties.font;
+
+import android.content.Context;
+import android.graphics.Typeface;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.BaseAdapter;
+
+import androidx.annotation.NonNull;
+import androidx.appcompat.widget.AppCompatTextView;
+
+import com.compdfkit.core.annotation.CPDFTextAttribute;
+import com.compdfkit.core.font.CPDFFont;
+import com.compdfkit.core.font.CPDFFontName;
+import com.compdfkit.tools.R;
+
+import java.util.ArrayList;
+import java.util.List;
+
+
+public class CFontSpinnerAdapter1 extends BaseAdapter {
+
+    private List<CPDFTextAttribute.FontNameHelper.FontType> list;
+
+    private List<CPDFFontName> outFontList;
+
+    private Context mContext;
+
+    public CFontSpinnerAdapter1(@NonNull Context context) {
+        ArrayList<CPDFTextAttribute.FontNameHelper.FontType> tempList = new ArrayList<>();
+        tempList.add(CPDFTextAttribute.FontNameHelper.FontType.Helvetica);
+        tempList.add(CPDFTextAttribute.FontNameHelper.FontType.Courier);
+        tempList.add(CPDFTextAttribute.FontNameHelper.FontType.Times_Roman);
+        list = tempList;
+        outFontList= CPDFFont.getOutFontName();
+        mContext = context;
+    }
+
+    @Override
+    public int getCount() {
+        return list.size() + (outFontList == null ? 0 : outFontList.size());
+    }
+
+    @Override
+    public Object getItem(int position) {
+        if (position < list.size()) {
+            return list.get(position);
+        } else {
+            if (outFontList != null) {
+                return outFontList.get(position - list.size());
+            }
+            return null;
+        }
+    }
+
+    @Override
+    public long getItemId(int position) {
+        return position;
+    }
+
+    @Override
+    public View getView(int position, View convertView, ViewGroup parent) {
+        LayoutInflater inflater = LayoutInflater.from(mContext);
+        convertView = inflater.inflate(R.layout.tools_spinner_list_item, null);
+        if (convertView != null){
+            AppCompatTextView textView = convertView.findViewById(R.id.tv_menu_title);
+            if (position < list.size()){
+                CPDFTextAttribute.FontNameHelper.FontType fontType = (CPDFTextAttribute.FontNameHelper.FontType) getItem(position);
+                String fontName = CPDFTextAttribute.FontNameHelper.obtainFontName(fontType, false, false);
+                Typeface typeface = CPDFTextAttribute.FontNameHelper.getInnerTypeface(textView.getContext(), fontName);
+                if (fontType == CPDFTextAttribute.FontNameHelper.FontType.Unknown){
+                    textView.setTypeface(Typeface.DEFAULT);
+                    textView.setText(CPDFTextAttribute.FontNameHelper.FontType.Unknown.name());
+                } else {
+                    textView.setTypeface(typeface);
+                    textView.setText(fontName);
+                }
+            }else {
+                CPDFFontName outFontName = (CPDFFontName) getItem(position);
+                String outFont = CPDFTextAttribute.FontNameHelper.obtainOutFontName(outFontName.getFamilyName(), false,false);
+                Typeface typeface = CPDFTextAttribute.FontNameHelper.getTypeface(mContext, outFont);
+                textView.setTypeface(typeface);
+                textView.setText(outFontName.getFamilyName());
+            }
+        }
+        return convertView;
+    }
+
+    public int getPosition(String fontName){
+        for (int i = 0; i < list.size(); i++) {
+            CPDFTextAttribute.FontNameHelper.FontType fontType = list.get(i);
+            if (fontType.name().equals(fontName)){
+                return i;
+            }
+        }
+        for (int i = 0; i < outFontList.size(); i++) {
+            CPDFFontName name = outFontList.get(i);
+            if (name.getFamilyName().equals(fontName)) {
+                return list.size() + i;
+            }
+        }
+        return 0;
+    }
+
+    public CPDFFontName getCPDFFontName(String familyName){
+        for (CPDFFontName cpdfFontName : outFontList) {
+            if (cpdfFontName.getFamilyName().equals(familyName)) {
+                return cpdfFontName;
+            }
+        }
+        return null;
+    }
+}

+ 134 - 0
ComPDFKit_Tools/src/main/java/com/compdfkit/tools/common/views/pdfproperties/font/CFontStyleSpinnerAdapter.java

@@ -0,0 +1,134 @@
+package com.compdfkit.tools.common.views.pdfproperties.font;
+
+import android.content.Context;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.BaseAdapter;
+
+import androidx.annotation.NonNull;
+import androidx.appcompat.widget.AppCompatTextView;
+
+import com.compdfkit.core.annotation.CPDFTextAttribute;
+import com.compdfkit.core.font.CPDFFontName;
+import com.compdfkit.tools.R;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+/**
+ * @classname:
+ * @author: LiuXiaoLong
+ * @date: 2024/2/26
+ * description:
+ */
+public class CFontStyleSpinnerAdapter extends BaseAdapter {
+
+    enum FontStyle {
+        Normal,
+
+        Bold,
+
+        Italic,
+
+        Bold_Italic
+    }
+
+    private List<FontStyle> list;
+
+    private Context mContext;
+
+    public CFontStyleSpinnerAdapter(@NonNull Context context) {
+        list = new ArrayList<>();
+        mContext = context;
+    }
+
+    @Override
+    public int getCount() {
+        return list.size();
+    }
+
+    @Override
+    public FontStyle getItem(int position) {
+        return list.get(position);
+    }
+
+    @Override
+    public long getItemId(int position) {
+        return position;
+    }
+
+    @Override
+    public View getView(int position, View convertView, ViewGroup parent) {
+        LayoutInflater inflater = LayoutInflater.from(mContext);
+        convertView = inflater.inflate(R.layout.tools_spinner_list_item, null);
+        if (convertView != null) {
+            AppCompatTextView textView = convertView.findViewById(R.id.tv_menu_title);
+            switch (list.get(position)){
+                case Normal:
+                    textView.setText(R.string.tools_font_style_normal);
+                    break;
+                case Bold:
+                    textView.setText(R.string.tools_font_style_bold);
+
+                    break;
+                case Italic:
+                    textView.setText(R.string.tools_font_style_italic);
+
+                    break;
+                case Bold_Italic:
+                    textView.setText(R.string.tools_font_style_bold_italic);
+                    break;
+            }
+
+        }
+        return convertView;
+    }
+
+    public void updateFontStyle(CPDFTextAttribute.FontNameHelper.FontType fontType){
+        list.clear();
+        list.addAll(Arrays.asList(FontStyle.values()));
+        notifyDataSetChanged();
+    }
+
+    public void updateFontStyle(CPDFFontName outFamilyName){
+       list.clear();
+       list.add(FontStyle.Normal);
+       if (outFamilyName.isSupportBold()){
+           list.add(FontStyle.Bold);
+       }
+
+       if (outFamilyName.isSupportItalic()){
+           list.add(FontStyle.Italic);
+       }
+       if (outFamilyName.isSupportBold() && outFamilyName.isSupportItalic()){
+           list.add(FontStyle.Bold_Italic);
+       }
+       notifyDataSetChanged();
+    }
+
+    public int getIndex(boolean isBold, boolean isItalic){
+        FontStyle style = FontStyle.Normal;
+        if (isBold){
+            style = FontStyle.Bold;
+        }
+        if (isItalic){
+            if (isBold){
+                style = FontStyle.Bold_Italic;
+            }else {
+                style = FontStyle.Italic;
+            }
+        }
+
+        for (int i = 0; i < list.size(); i++) {
+            FontStyle item = list.get(i);
+            if (item == style){
+                return i;
+            }
+        }
+        return 0;
+    }
+
+
+}

+ 224 - 0
ComPDFKit_Tools/src/main/java/com/compdfkit/tools/common/views/pdfproperties/font/CPDFFontView.java

@@ -0,0 +1,224 @@
+/**
+ * Copyright © 2014-2023 PDF Technologies, Inc. All Rights Reserved.
+ * <p>
+ * THIS SOURCE CODE AND ANY ACCOMPANYING DOCUMENTATION ARE PROTECTED BY INTERNATIONAL COPYRIGHT LAW
+ * AND MAY NOT BE RESOLD OR REDISTRIBUTED. USAGE IS BOUND TO THE ComPDFKit LICENSE AGREEMENT.
+ * UNAUTHORIZED REPRODUCTION OR DISTRIBUTION IS SUBJECT TO CIVIL AND CRIMINAL PENALTIES.
+ * This notice may not be removed from this file.
+ */
+
+package com.compdfkit.tools.common.views.pdfproperties.font;
+
+import android.content.Context;
+import android.graphics.Typeface;
+import android.util.AttributeSet;
+import android.view.View;
+import android.widget.AdapterView;
+import android.widget.LinearLayout;
+import android.widget.Spinner;
+
+import androidx.annotation.Nullable;
+
+import com.compdfkit.core.annotation.CPDFTextAttribute;
+import com.compdfkit.core.font.CPDFFont;
+import com.compdfkit.core.font.CPDFFontName;
+import com.compdfkit.tools.R;
+import com.compdfkit.tools.common.utils.CLog;
+
+import java.util.ArrayList;
+
+
+public class CPDFFontView extends LinearLayout {
+
+    private Spinner fontSpinner;
+
+    private Spinner fontStyleSpinner;
+
+    private CFontSpinnerAdapter1 fontAdapter;
+
+    private CFontStyleSpinnerAdapter fontStyleSpinnerAdapter;
+
+    private boolean fontIsBold = false;
+
+    private boolean fontIsItalic = false;
+
+    private CFontChangeListener fontChangeListener;
+
+    private CFontTypefaceListener typefaceListener;
+
+    public CPDFFontView(Context context) {
+        this(context, null);
+    }
+
+    public CPDFFontView(Context context, @Nullable AttributeSet attrs) {
+        this(context, attrs, 0);
+    }
+
+    public CPDFFontView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
+        super(context, attrs, defStyleAttr);
+        initView(context);
+    }
+
+    private void initView(Context context) {
+        View view = inflate(context, R.layout.tools_cpdf_font_view, this);
+        fontSpinner = view.findViewById(R.id.spinner_font);
+        fontStyleSpinner = view.findViewById(R.id.spinner_font_style);
+        if (!isInEditMode()) {
+            fontAdapter = new CFontSpinnerAdapter1(context);
+            fontSpinner.setAdapter(fontAdapter);
+
+
+            fontStyleSpinnerAdapter = new CFontStyleSpinnerAdapter(context);
+            fontStyleSpinner.setAdapter(fontStyleSpinnerAdapter);
+
+        }
+    }
+
+    private int fontCheck = 0;
+    private int fontStyleCheck = 0;
+
+    public void initFont(String fontName, boolean isBold, boolean isItalic) {
+        fontCheck = 0;
+        fontStyleCheck = 0;
+        fontSpinner.setSelection(fontAdapter.getPosition(fontName));
+        switch (fontName) {
+            case "Courier":
+            case "Helvetica":
+            case "Times_Roman":
+                fontStyleSpinnerAdapter.updateFontStyle(CPDFTextAttribute.FontNameHelper.FontType.valueOf(fontName));
+                break;
+            default:
+                CPDFFontName cpdfFontName = fontAdapter.getCPDFFontName(fontName);
+                if (cpdfFontName != null) {
+                    fontStyleSpinnerAdapter.updateFontStyle(cpdfFontName);
+                } else {
+                    fontStyleSpinnerAdapter.updateFontStyle(CPDFTextAttribute.FontNameHelper.FontType.Helvetica);
+                }
+                break;
+        }
+        int fontStyleIndex = fontStyleSpinnerAdapter.getIndex(isBold, isItalic);
+        fontStyleSpinner.setSelection(fontStyleIndex);
+        updateStyle(fontStyleSpinnerAdapter.getItem(fontStyleIndex));
+
+        fontSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
+            @Override
+            public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
+                if (++fontCheck > 1) {
+
+                    Object fontObj = fontAdapter.getItem(position);
+                    if (fontObj instanceof CPDFTextAttribute.FontNameHelper.FontType) {
+                        if (fontChangeListener != null) {
+                            fontChangeListener.font((CPDFTextAttribute.FontNameHelper.FontType) fontObj, null);
+                        }
+                        fontStyleSpinnerAdapter.updateFontStyle((CPDFTextAttribute.FontNameHelper.FontType) fontObj);
+                        resetFontStyle();
+                    } else if (fontObj instanceof CPDFFontName) {
+                        CPDFFontName cpdfFontName = (CPDFFontName) fontObj;
+                        if (fontChangeListener != null) {
+                            fontChangeListener.font(null, cpdfFontName.getFamilyName());
+                        }
+                        ArrayList<String> psNames = cpdfFontName.getPsName();
+                        CLog.e("字体", cpdfFontName.getFamilyName() + " styleName: " + cpdfFontName.getStyleName());
+                        CLog.e("字体", "psName----- >");
+                        for (String psName : psNames) {
+                            CLog.e("字体", psName);
+                        }
+                        CLog.e("字体", "psName----- <");
+                        fontStyleSpinnerAdapter.updateFontStyle(((CPDFFontName) fontObj));
+                        resetFontStyle();
+                    }
+                    changeTypefaceListener();
+                }
+            }
+
+            @Override
+            public void onNothingSelected(AdapterView<?> parent) {
+
+            }
+        });
+
+
+        fontStyleSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
+            @Override
+            public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
+                if (++fontStyleCheck > 1){
+                    CFontStyleSpinnerAdapter.FontStyle fontStyle = fontStyleSpinnerAdapter.getItem(position);
+                    updateStyle(fontStyle);
+                    if (fontChangeListener != null) {
+                        fontChangeListener.fontStyle(fontIsBold, fontIsItalic);
+                    }
+                    changeTypefaceListener();
+                }
+            }
+
+            @Override
+            public void onNothingSelected(AdapterView<?> parent) {
+
+            }
+        });
+
+    }
+
+    private void changeTypefaceListener() {
+        if (typefaceListener != null) {
+            Object font = fontSpinner.getSelectedItem();
+            if (font instanceof CPDFTextAttribute.FontNameHelper.FontType) {
+                String fontTypeName = CPDFTextAttribute.FontNameHelper.obtainFontName((CPDFTextAttribute.FontNameHelper.FontType) font, fontIsBold, fontIsItalic);
+                Typeface typeface = CPDFTextAttribute.FontNameHelper.getTypeface(getContext(), fontTypeName);
+                typefaceListener.typeface(typeface);
+            } else if (font instanceof CPDFFontName) {
+                String psName = CPDFFont.getPsName(((CPDFFontName) font).getFamilyName(), fontIsBold, fontIsItalic);
+                Typeface typeface = CPDFTextAttribute.FontNameHelper.getOutTypeface(getContext(), psName);
+                typefaceListener.typeface(typeface);
+            }
+        }
+    }
+
+    private void resetFontStyle() {
+        fontIsBold = false;
+        fontIsItalic = false;
+        fontStyleSpinner.setSelection(0);
+    }
+
+    private void updateStyle(CFontStyleSpinnerAdapter.FontStyle fontStyle) {
+        switch (fontStyle) {
+            case Bold:
+                fontIsBold = true;
+                fontIsItalic = false;
+                break;
+            case Italic:
+                fontIsBold = false;
+                fontIsItalic = true;
+                break;
+            case Bold_Italic:
+                fontIsBold = true;
+                fontIsItalic = true;
+                break;
+            default:
+                fontIsBold = false;
+                fontIsItalic = false;
+                break;
+        }
+    }
+
+    public void setFontChangeListener(CFontChangeListener fontChangeListener) {
+        this.fontChangeListener = fontChangeListener;
+    }
+
+    public void setTypefaceListener(CFontTypefaceListener typefaceListener) {
+        this.typefaceListener = typefaceListener;
+    }
+
+    public interface CFontChangeListener {
+        void font(CPDFTextAttribute.FontNameHelper.FontType fontType, String outFontName);
+
+
+        void fontStyle(boolean bold, boolean italic);
+    }
+
+
+    public interface CFontTypefaceListener {
+        void typeface(Typeface typeface);
+    }
+
+}

+ 3 - 39
ComPDFKit_Tools/src/main/java/com/compdfkit/tools/common/views/pdfproperties/pdfstyle/manager/provider/CEditSelectionsProvider.java

@@ -14,12 +14,10 @@ import android.os.Environment;
 import android.provider.MediaStore;
 import android.text.TextUtils;
 
-import com.compdfkit.core.annotation.CPDFTextAttribute;
 import com.compdfkit.core.edit.CPDFEditArea;
 import com.compdfkit.core.edit.CPDFEditImageArea;
 import com.compdfkit.core.edit.CPDFEditTextArea;
 import com.compdfkit.tools.R;
-import com.compdfkit.tools.common.utils.CLog;
 import com.compdfkit.tools.common.utils.CToastUtil;
 import com.compdfkit.tools.common.views.pdfproperties.pdfstyle.CAnnotStyle;
 import com.compdfkit.tools.common.views.pdfproperties.pdfstyle.CStyleType;
@@ -61,7 +59,6 @@ public class CEditSelectionsProvider implements CStyleProvider {
                     textSelections.setColor(style.getTextColor());
                 } else if (type == CAnnotStyle.EditUpdatePropertyType.TextColorOpacity) {
                     textSelections.setTransparancy(style.getTextColorOpacity());
-
                 } else if (type == CAnnotStyle.EditUpdatePropertyType.Italic) {
                     textSelections.setItalic(style.isFontItalic());
                 } else if (type == CAnnotStyle.EditUpdatePropertyType.Bold) {
@@ -76,18 +73,7 @@ public class CEditSelectionsProvider implements CStyleProvider {
                         textSelections.setAlign(CPDFEditTextArea.PDFEditAlignType.PDFEditAlignRight);
                     }
                 } else if (type == CAnnotStyle.EditUpdatePropertyType.FontType) {
-                    CPDFTextAttribute.FontNameHelper.FontType font = style.getFontType();
-                    if (font == CPDFTextAttribute.FontNameHelper.FontType.Courier) {
-                        CLog.e("数据", "isBold:"+textSelections.isBold() +", isItalic:" + textSelections.isItalic());
-                        textSelections.setFontName(CPDFEditTextArea.FontCourier);
-
-                    } else if (font == CPDFTextAttribute.FontNameHelper.FontType.Helvetica) {
-                        textSelections.setFontName(CPDFEditTextArea.FontHelvtics);
-                    } else if (font == CPDFTextAttribute.FontNameHelper.FontType.Times_Roman) {
-                        textSelections.setFontName(CPDFEditTextArea.FontTimesRoman);
-                    } else {
-                        textSelections.setFontName(style.getExternFontName());
-                    }
+                    textSelections.setFontName(getAnnotStyleFontName(style));
                 } else {
                     textSelections.setColor(style.getTextColor());
                     textSelections.setTransparancy(style.getTextColorOpacity());
@@ -102,16 +88,7 @@ public class CEditSelectionsProvider implements CStyleProvider {
                     } else if (align == CAnnotStyle.Alignment.RIGHT) {
                         textSelections.setAlign(CPDFEditTextArea.PDFEditAlignType.PDFEditAlignRight);
                     }
-                    CPDFTextAttribute.FontNameHelper.FontType font = style.getFontType();
-                    if (font == CPDFTextAttribute.FontNameHelper.FontType.Courier) {
-                        textSelections.setFontName(CPDFEditTextArea.FontCourier);
-                    } else if (font == CPDFTextAttribute.FontNameHelper.FontType.Helvetica) {
-                        textSelections.setFontName(CPDFEditTextArea.FontHelvtics);
-                    } else if (font == CPDFTextAttribute.FontNameHelper.FontType.Times_Roman) {
-                        textSelections.setFontName(CPDFEditTextArea.FontTimesRoman);
-                    } else {
-                        textSelections.setFontName(style.getExternFontName());
-                    }
+                    textSelections.setFontName(getAnnotStyleFontName(style));
                 }
             } else if (style.getType() == CStyleType.EDIT_IMAGE) {
                 CAnnotStyle.EditUpdatePropertyType updatePropertyType = style.getUpdatePropertyType();
@@ -190,20 +167,7 @@ public class CEditSelectionsProvider implements CStyleProvider {
             style.setFontColor(textSelections.getColor());
             int fontsize = (int) textSelections.getFontSize();
             style.setFontSize(fontsize > 0 ? fontsize : 25);
-            String fontname = textSelections.getFontName();
-            if (fontname != null) {
-                if (fontname.contains("Courier")) {
-                    style.setFontType(CPDFTextAttribute.FontNameHelper.FontType.Courier);
-                } else if (fontname.contains("Helvetica")) {
-                    style.setFontType(CPDFTextAttribute.FontNameHelper.FontType.Helvetica);
-                } else if (fontname.contains("Times")) {
-                    style.setFontType(CPDFTextAttribute.FontNameHelper.FontType.Times_Roman);
-                } else {
-                    style.setExternFontName(fontname);
-                }
-            } else {
-                style.setFontType(CPDFTextAttribute.FontNameHelper.FontType.Unknown);
-            }
+            updateAnnotStyleFont(style, textSelections.getFontName());
         } else if (style.getType() == CStyleType.EDIT_IMAGE) {
             CPDFEditArea editArea = pageView.getCurrentEditArea();
             if (editArea != null && editArea instanceof CPDFEditImageArea) {

+ 11 - 19
ComPDFKit_Tools/src/main/java/com/compdfkit/tools/common/views/pdfproperties/pdfstyle/manager/provider/CGlobalStyleProvider.java

@@ -237,8 +237,7 @@ public class CGlobalStyleProvider extends CBasicOnStyleChangeListener implements
                             break;
                     }
                     freetextAttr.setAlpha(params.getTextColorOpacity());
-                    String fontName = CPDFTextAttribute.FontNameHelper.obtainFontName(params.getFontType(), params.isFontBold(), params.isFontItalic());
-                    freetextAttr.setTextAttribute(new CPDFTextAttribute(fontName, params.getFontSize(), params.getTextColor()));
+                    freetextAttr.setTextAttribute(new CPDFTextAttribute(getAnnotStyleFontName(params), params.getFontSize(), params.getTextColor()));
                     callback = freetextAttr;
                     break;
                 case ANNOT_SIGNATURE:
@@ -262,8 +261,7 @@ public class CGlobalStyleProvider extends CBasicOnStyleChangeListener implements
                     textFieldAttr.setBorderColor(params.getLineColor());
                     textFieldAttr.setFillColor(params.getFillColor());
                     textFieldAttr.setiAttributeUpdateCallback(() -> getDefaultFiledName("Text Field_"));
-                    String textFieldFontName = CPDFTextAttribute.FontNameHelper.obtainFontName(params.getFontType(), params.isFontBold(), params.isFontItalic());
-                    textFieldAttr.setTextAttribute(new CPDFTextAttribute(textFieldFontName, params.getFontSize(), params.getTextColor()));
+                    textFieldAttr.setTextAttribute(new CPDFTextAttribute(getAnnotStyleFontName(params), params.getFontSize(), params.getTextColor()));
                     textFieldAttr.setMultiline(params.isFormMultiLine());
                     switch (params.getAlignment()) {
                         case LEFT:
@@ -310,8 +308,7 @@ public class CGlobalStyleProvider extends CBasicOnStyleChangeListener implements
                     listBoxAttr.setFillColor(params.getFillColor());
                     listBoxAttr.setBorderWidth(params.getBorderWidth());
                     listBoxAttr.setBorderColor(params.getLineColor());
-                    String listBoxFontName = CPDFTextAttribute.FontNameHelper.obtainFontName(params.getFontType(), params.isFontBold(), params.isFontItalic());
-                    listBoxAttr.setFontName(listBoxFontName);
+                    listBoxAttr.setFontName(getAnnotStyleFontName(params));
                     listBoxAttr.setiAttributeUpdateCallback(() -> getDefaultFiledName("List Choice_"));
                     callback = listBoxAttr;
                     break;
@@ -322,8 +319,7 @@ public class CGlobalStyleProvider extends CBasicOnStyleChangeListener implements
                     comboBoxAttr.setFontColor(params.getTextColor());
                     comboBoxAttr.setBorderWidth(params.getBorderWidth());
                     comboBoxAttr.setBorderColor(params.getLineColor());
-                    String comboBoxFontName = CPDFTextAttribute.FontNameHelper.obtainFontName(params.getFontType(), params.isFontBold(), params.isFontItalic());
-                    comboBoxAttr.setFontName(comboBoxFontName);
+                    comboBoxAttr.setFontName(getAnnotStyleFontName(params));
                     comboBoxAttr.setiAttributeUpdateCallback(() -> getDefaultFiledName("Combox Choice_"));
                     callback = comboBoxAttr;
                     break;
@@ -335,8 +331,7 @@ public class CGlobalStyleProvider extends CBasicOnStyleChangeListener implements
                     pushButtonAttr.setFontColor(params.getTextColor());
                     pushButtonAttr.setFontSize(params.getFontSize());
                     pushButtonAttr.setButtonTitle(params.getFormDefaultValue());
-                    String pushButtonFontName = CPDFTextAttribute.FontNameHelper.obtainFontName(params.getFontType(), params.isFontBold(), params.isFontItalic());
-                    pushButtonAttr.setFontName(pushButtonFontName);
+                    pushButtonAttr.setFontName(getAnnotStyleFontName(params));
                     pushButtonAttr.setiAttributeUpdateCallback(() -> getDefaultFiledName("Push Button_"));
                     callback = pushButtonAttr;
                     break;
@@ -506,10 +501,11 @@ public class CGlobalStyleProvider extends CBasicOnStyleChangeListener implements
                 style.setTextColorOpacity(freetextAttr.getAlpha());
                 CPDFTextAttribute textAttribute = freetextAttr.getTextAttribute();
                 style.setFontColor(textAttribute.getColor());
-                style.setFontType(CPDFTextAttribute.FontNameHelper.getFontType(textAttribute.getFontName()));
                 style.setFontBold(CPDFTextAttribute.FontNameHelper.isBold(textAttribute.getFontName()));
                 style.setFontItalic(CPDFTextAttribute.FontNameHelper.isItalic(textAttribute.getFontName()));
                 style.setFontSize((int) textAttribute.getFontSize());
+
+                updateAnnotStyleFont(style, textAttribute.getFontName());
                 break;
             case FORM_TEXT_FIELD:
                 CPDFTextfieldAttr textFieldAttr = attribute.getTextfieldAttr();
@@ -519,8 +515,7 @@ public class CGlobalStyleProvider extends CBasicOnStyleChangeListener implements
                 style.setFontColor(textFieldAttr.getFontColor());
                 style.setBorderColor(textFieldAttr.getBorderColor());
                 style.setFillColor(textFieldAttr.getFillColor());
-                CPDFTextAttribute.FontNameHelper.FontType fontType = CPDFTextAttribute.FontNameHelper.getFontType(textFieldAttr.getFontName());
-                style.setFontType(fontType);
+                updateAnnotStyleFont(style, textFieldAttr.getFontName());
                 style.setFontBold(CPDFTextAttribute.FontNameHelper.isBold(textFieldAttr.getFontName()));
                 style.setFontItalic(CPDFTextAttribute.FontNameHelper.isItalic(textFieldAttr.getFontName()));
                 style.setFontSize((int) textFieldAttr.getFontSize());
@@ -547,8 +542,7 @@ public class CGlobalStyleProvider extends CBasicOnStyleChangeListener implements
                 style.setFillColor(listboxAttr.getFillColor());
                 style.setBorderColor(listboxAttr.getBorderColor());
                 style.setBorderWidth(listboxAttr.getBorderWidth());
-                CPDFTextAttribute.FontNameHelper.FontType listBoxFontType = CPDFTextAttribute.FontNameHelper.getFontType(listboxAttr.getFontName());
-                style.setFontType(listBoxFontType);
+                updateAnnotStyleFont(style, listboxAttr.getFontName());
                 style.setFontBold(CPDFTextAttribute.FontNameHelper.isBold(listboxAttr.getFontName()));
                 style.setFontItalic(CPDFTextAttribute.FontNameHelper.isItalic(listboxAttr.getFontName()));
                 break;
@@ -559,8 +553,7 @@ public class CGlobalStyleProvider extends CBasicOnStyleChangeListener implements
                 style.setFillColor(comboBoxAttr.getFillColor());
                 style.setBorderColor(comboBoxAttr.getBorderColor());
                 style.setBorderWidth(comboBoxAttr.getBorderWidth());
-                CPDFTextAttribute.FontNameHelper.FontType comBoBoxFontType = CPDFTextAttribute.FontNameHelper.getFontType(comboBoxAttr.getFontName());
-                style.setFontType(comBoBoxFontType);
+                updateAnnotStyleFont(style, comboBoxAttr.getFontName());
                 style.setFontBold(CPDFTextAttribute.FontNameHelper.isBold(comboBoxAttr.getFontName()));
                 style.setFontItalic(CPDFTextAttribute.FontNameHelper.isItalic(comboBoxAttr.getFontName()));
                 break;
@@ -571,8 +564,7 @@ public class CGlobalStyleProvider extends CBasicOnStyleChangeListener implements
                 style.setFontColor(pushButtonAttr.getFontColor());
                 style.setBorderColor(pushButtonAttr.getBorderColor());
                 style.setFillColor(pushButtonAttr.getFillColor());
-                CPDFTextAttribute.FontNameHelper.FontType pushButtonFontType = CPDFTextAttribute.FontNameHelper.getFontType(pushButtonAttr.getFontName());
-                style.setFontType(pushButtonFontType);
+                updateAnnotStyleFont(style, pushButtonAttr.getFontName());
                 style.setFontBold(CPDFTextAttribute.FontNameHelper.isBold(pushButtonAttr.getFontName()));
                 style.setFontItalic(CPDFTextAttribute.FontNameHelper.isItalic(pushButtonAttr.getFontName()));
                 style.setFontSize((int) pushButtonAttr.getFontSize());

+ 3 - 7
ComPDFKit_Tools/src/main/java/com/compdfkit/tools/common/views/pdfproperties/pdfstyle/manager/provider/CSelectedAnnotStyleProvider.java

@@ -9,8 +9,6 @@
 
 package com.compdfkit.tools.common.views.pdfproperties.pdfstyle.manager.provider;
 
-import android.util.Log;
-
 import com.compdfkit.core.annotation.CPDFBorderStyle;
 import com.compdfkit.core.annotation.CPDFCircleAnnotation;
 import com.compdfkit.core.annotation.CPDFFreetextAnnotation;
@@ -85,7 +83,6 @@ public class CSelectedAnnotStyleProvider implements CStyleProvider {
                 annotImpl.onAnnotAttrChange();
                 pageView.invalidate();
             } else if (annotImpl instanceof CPDFCircleAnnotImpl) {
-                Log.e("TEST","修改虚线");
                 CPDFCircleAnnotImpl circleAnnot = (CPDFCircleAnnotImpl) annotImpl;
                 CPDFCircleAnnotation circleAnnotation = circleAnnot.onGetAnnotation();
                 circleAnnotation.setBorderColor(style.getLineColor());
@@ -113,7 +110,6 @@ public class CSelectedAnnotStyleProvider implements CStyleProvider {
             } else if (annotImpl instanceof CPDFFreetextAnnotImpl) {
                 CPDFFreetextAnnotImpl freetextAnnot = (CPDFFreetextAnnotImpl) annotImpl;
                 CPDFFreetextAnnotation freetextAnnotation = freetextAnnot.onGetAnnotation();
-                Log.e("Test", "getAlignment:"+ style.getAlignment().name());
                 switch (style.getAlignment()) {
                     case LEFT:
                         freetextAnnotation.setFreetextAlignment(CPDFFreetextAnnotation.Alignment.ALIGNMENT_LEFT);
@@ -129,8 +125,7 @@ public class CSelectedAnnotStyleProvider implements CStyleProvider {
                         break;
                 }
                 freetextAnnotation.setAlpha(style.getTextColorOpacity());
-                String fontName = CPDFTextAttribute.FontNameHelper.obtainFontName(style.getFontType(), style.isFontBold(), style.isFontItalic());
-                freetextAnnotation.setFreetextDa(new CPDFTextAttribute(fontName, style.getFontSize(), style.getTextColor()));
+                freetextAnnotation.setFreetextDa(new CPDFTextAttribute(getAnnotStyleFontName(style), style.getFontSize(), style.getTextColor()));
                 freetextAnnotation.updateAp();
                 annotImpl.onAnnotAttrChange();
                 pageView.invalidate();
@@ -222,9 +217,9 @@ public class CSelectedAnnotStyleProvider implements CStyleProvider {
                 CPDFTextAttribute textAttribute = freetextAnnotation.getFreetextDa();
                 style.setFontColor(textAttribute.getColor());
                 style.setTextColorOpacity(freetextAnnotation.getAlpha());
-                style.setFontType(CPDFTextAttribute.FontNameHelper.getFontType(textAttribute.getFontName()));
                 style.setFontBold(CPDFTextAttribute.FontNameHelper.isBold(textAttribute.getFontName()));
                 style.setFontItalic(CPDFTextAttribute.FontNameHelper.isItalic(textAttribute.getFontName()));
+                updateAnnotStyleFont(style, textAttribute.getFontName());
                 style.setFontSize((int) textAttribute.getFontSize());
                 switch (freetextAnnotation.getFreetextAlignment()){
                     case ALIGNMENT_LEFT:
@@ -250,4 +245,5 @@ public class CSelectedAnnotStyleProvider implements CStyleProvider {
     public CAnnotStyle getStyle() {
         return getStyle(CTypeUtil.getStyleType(annotImpl.getAnnotType()));
     }
+
 }

+ 10 - 18
ComPDFKit_Tools/src/main/java/com/compdfkit/tools/common/views/pdfproperties/pdfstyle/manager/provider/CSelectedFormStyleProvider.java

@@ -67,8 +67,8 @@ public class CSelectedFormStyleProvider implements CStyleProvider {
                 textWidget.setBorderWidth(style.getBorderWidth());
                 textWidget.setMultiLine(style.isFormMultiLine());
                 textWidget.setHidden(style.isHideForm());
-                String fontName = CPDFTextAttribute.FontNameHelper.obtainFontName(style.getFontType(), style.isFontBold(), style.isFontItalic());
-                textWidget.setFontName(fontName);
+                textWidget.setFontName(getAnnotStyleFontName(style));
+
                 textWidget.setText(style.getFormDefaultValue());
                 switch (style.getAlignment()) {
                     case LEFT:
@@ -129,12 +129,10 @@ public class CSelectedFormStyleProvider implements CStyleProvider {
                     listBoxWidget.setBorderWidth(0);
                 }
                 listBoxWidget.setBorderColor(style.getLineColor());
-                String fontName = CPDFTextAttribute.FontNameHelper.obtainFontName(style.getFontType(), style.isFontBold(), style.isFontItalic());
-
-                listBoxWidget.setFontName(fontName);
+                listBoxWidget.setFontName(getAnnotStyleFontName(style));
                 listBoxWidget.updateAp();
                 baseAnnotImpl.onAnnotAttrChange();
-                ((CPDFListboxWidgetImpl) baseAnnotImpl).refresh();
+//                ((CPDFListboxWidgetImpl) baseAnnotImpl).refresh();
                 if (pageView != null) {
                     pageView.invalidate();
                 }
@@ -150,8 +148,7 @@ public class CSelectedFormStyleProvider implements CStyleProvider {
                     comboBoxWidget.setBorderWidth(0);
                 }
                 comboBoxWidget.setBorderColor(style.getLineColor());
-                String fontName = CPDFTextAttribute.FontNameHelper.obtainFontName(style.getFontType(), style.isFontBold(), style.isFontItalic());
-                comboBoxWidget.setFontName(fontName);
+                comboBoxWidget.setFontName(getAnnotStyleFontName(style));
                 comboBoxWidget.updateAp();
                 baseAnnotImpl.onAnnotAttrChange();
                 if (pageView != null) {
@@ -166,8 +163,7 @@ public class CSelectedFormStyleProvider implements CStyleProvider {
                 pushButtonWidget.setFontColor(style.getTextColor());
                 pushButtonWidget.setFillColor(style.getFillColor());
                 pushButtonWidget.setBorderColor(style.getLineColor());
-                String fontName = CPDFTextAttribute.FontNameHelper.obtainFontName(style.getFontType(), style.isFontBold(), style.isFontItalic());
-                pushButtonWidget.setFontName(fontName);
+                pushButtonWidget.setFontName(getAnnotStyleFontName(style));
                 pushButtonWidget.setButtonTitle(style.getFormDefaultValue());
                 pushButtonWidget.updateAp();
                 baseAnnotImpl.onAnnotAttrChange();
@@ -191,8 +187,7 @@ public class CSelectedFormStyleProvider implements CStyleProvider {
             style.setFontColor(textWidget.getFontColor());
             style.setBorderColor(textWidget.getBorderColor());
             style.setFillColor(textWidget.getFillColor());
-            CPDFTextAttribute.FontNameHelper.FontType fontType = CPDFTextAttribute.FontNameHelper.getFontType(textWidget.getFontName());
-            style.setFontType(fontType);
+            updateAnnotStyleFont(style, textWidget.getFontName());
             style.setBorderWidth(textWidget.getBorderWidth());
             style.setFontBold(CPDFTextAttribute.FontNameHelper.isBold(textWidget.getFontName()));
             style.setFontItalic(CPDFTextAttribute.FontNameHelper.isItalic(textWidget.getFontName()));
@@ -239,8 +234,7 @@ public class CSelectedFormStyleProvider implements CStyleProvider {
             style.setFontSize((int) listBoxWidget.getFontSize());
             style.setFormFieldName(listBoxWidget.getFieldName());
             style.setHideForm(listBoxWidget.isHidden());
-            CPDFTextAttribute.FontNameHelper.FontType fontType = CPDFTextAttribute.FontNameHelper.getFontType(listBoxWidget.getFontName());
-            style.setFontType(fontType);
+            updateAnnotStyleFont(style, listBoxWidget.getFontName());
             style.setFontBold(CPDFTextAttribute.FontNameHelper.isBold(listBoxWidget.getFontName()));
             style.setFontItalic(CPDFTextAttribute.FontNameHelper.isItalic(listBoxWidget.getFontName()));
         } else if (baseAnnotImpl instanceof CPDFComboboxWidgetImpl){
@@ -252,8 +246,7 @@ public class CSelectedFormStyleProvider implements CStyleProvider {
             style.setFontSize((int) comboBoxWidget.getFontSize());
             style.setFormFieldName(comboBoxWidget.getFieldName());
             style.setHideForm(comboBoxWidget.isHidden());
-            CPDFTextAttribute.FontNameHelper.FontType fontType = CPDFTextAttribute.FontNameHelper.getFontType(comboBoxWidget.getFontName());
-            style.setFontType(fontType);
+            updateAnnotStyleFont(style, comboBoxWidget.getFontName());
             style.setFontBold(CPDFTextAttribute.FontNameHelper.isBold(comboBoxWidget.getFontName()));
             style.setFontItalic(CPDFTextAttribute.FontNameHelper.isItalic(comboBoxWidget.getFontName()));
         } else if (baseAnnotImpl instanceof CPDFPushbuttonWidgetImpl){
@@ -265,8 +258,7 @@ public class CSelectedFormStyleProvider implements CStyleProvider {
             style.setFontSize((int) pushButtonWidget.getFontSize());
             style.setFormFieldName(pushButtonWidget.getFieldName());
             style.setHideForm(pushButtonWidget.isHidden());
-            CPDFTextAttribute.FontNameHelper.FontType fontType = CPDFTextAttribute.FontNameHelper.getFontType(pushButtonWidget.getFontName());
-            style.setFontType(fontType);
+            updateAnnotStyleFont(style, pushButtonWidget.getFontName());
             style.setFontBold(CPDFTextAttribute.FontNameHelper.isBold(pushButtonWidget.getFontName()));
             style.setFontItalic(CPDFTextAttribute.FontNameHelper.isItalic(pushButtonWidget.getFontName()));
             style.setFormDefaultValue(pushButtonWidget.getButtonTitle());

+ 29 - 0
ComPDFKit_Tools/src/main/java/com/compdfkit/tools/common/views/pdfproperties/pdfstyle/manager/provider/CStyleProvider.java

@@ -10,6 +10,11 @@
 package com.compdfkit.tools.common.views.pdfproperties.pdfstyle.manager.provider;
 
 
+import android.text.TextUtils;
+
+import com.compdfkit.core.annotation.CPDFTextAttribute;
+import com.compdfkit.core.font.CPDFFont;
+import com.compdfkit.tools.common.utils.CLog;
 import com.compdfkit.tools.common.views.pdfproperties.pdfstyle.CAnnotStyle;
 import com.compdfkit.tools.common.views.pdfproperties.pdfstyle.CStyleType;
 
@@ -23,4 +28,28 @@ public interface CStyleProvider {
 
     public CAnnotStyle getStyle(CStyleType type);
 
+
+    default public String getAnnotStyleFontName(CAnnotStyle annotStyle){
+        String fontName;
+        if (!TextUtils.isEmpty(annotStyle.getExternFontName())){
+            fontName = CPDFTextAttribute.FontNameHelper.obtainOutFontName(annotStyle.getExternFontName(), annotStyle.isFontBold(), annotStyle.isFontItalic());
+        } else {
+            fontName = CPDFTextAttribute.FontNameHelper.obtainFontName(annotStyle.getFontType(), annotStyle.isFontBold(), annotStyle.isFontItalic());
+        }
+        CLog.e("字体", "更新字体:" + fontName);
+
+        return fontName;
+    }
+
+    default public void updateAnnotStyleFont(CAnnotStyle annotStyle, String attrFontName){
+        String familyName = CPDFFont.getFamilyName(attrFontName);
+        CLog.e("字体", "获取到字体:" + attrFontName);
+        if (!TextUtils.isEmpty(familyName)){
+            annotStyle.setFontType(CPDFTextAttribute.FontNameHelper.FontType.Unknown);
+            annotStyle.setExternFontName(familyName);
+        }else {
+            annotStyle.setFontType(CPDFTextAttribute.FontNameHelper.getFontType(attrFontName));
+            annotStyle.setExternFontName("");
+        }
+    }
 }

+ 8 - 6
ComPDFKit_Tools/src/main/java/com/compdfkit/tools/common/views/pdfproperties/preview/CAnnotFreeTextPreviewView.java

@@ -24,6 +24,7 @@ import androidx.annotation.Nullable;
 import androidx.appcompat.widget.AppCompatTextView;
 
 import com.compdfkit.core.annotation.CPDFTextAttribute;
+import com.compdfkit.core.font.CPDFFont;
 import com.compdfkit.tools.R;
 import com.compdfkit.tools.common.views.pdfproperties.pdfstyle.CAnnotStyle;
 
@@ -40,7 +41,7 @@ public class CAnnotFreeTextPreviewView extends CBasicAnnotPreviewView {
 
     private CPDFTextAttribute.FontNameHelper.FontType fontType = CPDFTextAttribute.FontNameHelper.FontType.Helvetica;
 
-    private String externFontPath = "";
+    private String externFamilyName = "";
 
     public CAnnotFreeTextPreviewView(@NonNull Context context) {
         this(context, null);
@@ -85,11 +86,12 @@ public class CAnnotFreeTextPreviewView extends CBasicAnnotPreviewView {
 
     private Typeface getTypeFace(){
         Typeface typeface = null;
-        if (TextUtils.isEmpty(externFontPath)) {
+        if (TextUtils.isEmpty(externFamilyName)) {
             String fontName = CPDFTextAttribute.FontNameHelper.obtainFontName(fontType, isBold, isItalic);
              typeface = CPDFTextAttribute.FontNameHelper.getInnerTypeface(getContext(), fontName);
         } else {
-            typeface = Typeface.createFromFile(externFontPath);
+            String psName  = CPDFFont.getPsName(externFamilyName, isBold, isItalic);
+            typeface = CPDFTextAttribute.FontNameHelper.getOutTypeface(getContext(), psName);
         }
         return typeface;
     }
@@ -138,13 +140,13 @@ public class CAnnotFreeTextPreviewView extends CBasicAnnotPreviewView {
     public void setFontType(CPDFTextAttribute.FontNameHelper.FontType fontType) {
         super.setFontType(fontType);
         this.fontType = fontType;
-        externFontPath = "";
+        externFamilyName = "";
         textView.setTypeface(getTypeFace());
     }
 
     @Override
-    public void setExternFontType(String fontPath){
-        externFontPath = fontPath;
+    public void setExternFontType(String familyName){
+        externFamilyName = familyName;
         textView.setTypeface(getTypeFace());
     }
 }

+ 2 - 1
ComPDFKit_Tools/src/main/java/com/compdfkit/tools/common/views/pdfproperties/preview/CBasicAnnotPreviewView.java

@@ -84,6 +84,7 @@ abstract class CBasicAnnotPreviewView extends FrameLayout {
 
     public void setFontType(CPDFTextAttribute.FontNameHelper.FontType fontType){}
 
+
     public void setMirror(CAnnotStyle.Mirror mirror){
 
     }
@@ -92,5 +93,5 @@ abstract class CBasicAnnotPreviewView extends FrameLayout {
 
     }
 
-    public void setExternFontType(String fontName){}
+    public void setExternFontType(String familyName){}
 }

+ 2 - 2
ComPDFKit_Tools/src/main/java/com/compdfkit/tools/common/views/pdfproperties/preview/CStylePreviewView.java

@@ -164,9 +164,9 @@ public class CStylePreviewView extends FrameLayout {
         }
     }
 
-    public void setExternFontType(String name) {
+    public void setExternFontType(String familyName) {
         if (previewView != null) {
-            previewView.setExternFontType(name);
+            previewView.setExternFontType(familyName);
         }
     }
 

+ 28 - 99
ComPDFKit_Tools/src/main/java/com/compdfkit/tools/contenteditor/pdfproperties/CEditTextProperFragment.java

@@ -5,24 +5,20 @@ import android.text.TextUtils;
 import android.view.LayoutInflater;
 import android.view.View;
 import android.view.ViewGroup;
-import android.widget.AdapterView;
 import android.widget.LinearLayout;
-import android.widget.Spinner;
 
 import androidx.annotation.NonNull;
 import androidx.annotation.Nullable;
 import androidx.appcompat.widget.AppCompatImageView;
-import androidx.appcompat.widget.AppCompatTextView;
 
 import com.compdfkit.core.annotation.CPDFTextAttribute;
-import com.compdfkit.core.utils.CPDFSysFontUtils;
 import com.compdfkit.tools.R;
 import com.compdfkit.tools.common.utils.view.colorpicker.CColorPickerFragment;
 import com.compdfkit.tools.common.utils.view.colorpicker.widget.ColorPickerView;
 import com.compdfkit.tools.common.utils.view.sliderbar.CSliderBar;
 import com.compdfkit.tools.common.views.pdfproperties.basic.CBasicPropertiesFragment;
 import com.compdfkit.tools.common.views.pdfproperties.colorlist.ColorListView;
-import com.compdfkit.tools.common.views.pdfproperties.font.CExternFontSpinnerAdapter;
+import com.compdfkit.tools.common.views.pdfproperties.font.CPDFFontView;
 import com.compdfkit.tools.common.views.pdfproperties.pdfstyle.CAnnotStyle;
 import com.compdfkit.tools.common.views.pdfproperties.pdfstyle.CStyleFragmentDatas;
 import com.compdfkit.tools.common.views.pdfproperties.preview.CStylePreviewView;
@@ -31,7 +27,7 @@ import java.util.ArrayList;
 import java.util.List;
 
 public class CEditTextProperFragment extends CBasicPropertiesFragment
-        implements View.OnClickListener, ColorPickerView.COnColorChangeListener , ColorPickerView.COnColorAlphaChangeListener{
+        implements View.OnClickListener, ColorPickerView.COnColorChangeListener, ColorPickerView.COnColorAlphaChangeListener {
 
     private CStylePreviewView previewView;
 
@@ -39,12 +35,6 @@ public class CEditTextProperFragment extends CBasicPropertiesFragment
 
     private CSliderBar opacitySliderBar;
 
-    private AppCompatTextView tvFontType;
-
-    private AppCompatImageView tvFontItalic;
-
-    private AppCompatImageView tvFontBold;
-
     private LinearLayout llAlignment;
 
     private AppCompatImageView ivAlignmentLeft;
@@ -55,9 +45,7 @@ public class CEditTextProperFragment extends CBasicPropertiesFragment
 
     private CSliderBar fontSizeSliderBar;
 
-    private Spinner fontSpinner;
-
-    CExternFontSpinnerAdapter fontSpinnerAdapter;
+    private CPDFFontView fontView;
 
     private List<View> alignmentViews = new ArrayList<>();
 
@@ -76,18 +64,12 @@ public class CEditTextProperFragment extends CBasicPropertiesFragment
         previewView = rootView.findViewById(R.id.style_preview);
         colorListView = rootView.findViewById(R.id.border_color_list_view);
         opacitySliderBar = rootView.findViewById(R.id.slider_bar);
-        tvFontType = rootView.findViewById(R.id.tv_font_type);
-        tvFontItalic = rootView.findViewById(R.id.iv_font_italic);
-        tvFontBold = rootView.findViewById(R.id.iv_font_bold);
         llAlignment = rootView.findViewById(R.id.ll_alignment_type);
         ivAlignmentLeft = rootView.findViewById(R.id.iv_alignment_left);
         ivAlignmentCenter = rootView.findViewById(R.id.iv_alignment_center);
         ivAlignmentRight = rootView.findViewById(R.id.iv_alignment_right);
         fontSizeSliderBar = rootView.findViewById(R.id.font_size_slider_bar);
-        fontSpinner = rootView.findViewById(R.id.spinner_font);
-        tvFontType.setOnClickListener(this);
-        tvFontItalic.setOnClickListener(this);
-        tvFontBold.setOnClickListener(this);
+        fontView = rootView.findViewById(R.id.font_view);
         ivAlignmentLeft.setOnClickListener(this);
         ivAlignmentCenter.setOnClickListener(this);
         ivAlignmentRight.setOnClickListener(this);
@@ -115,48 +97,15 @@ public class CEditTextProperFragment extends CBasicPropertiesFragment
             previewView.setFontItalic(annotStyle.isFontItalic());
             previewView.setFontType(annotStyle.getFontType());
             previewView.setFontSize(annotStyle.getFontSize());
-            List<CPDFTextAttribute.FontNameHelper.FontType> fontTypes = new ArrayList<>();
-            fontTypes.add(CPDFTextAttribute.FontNameHelper.FontType.Unknown);
-            fontTypes.add(CPDFTextAttribute.FontNameHelper.FontType.Courier);
-            fontTypes.add(CPDFTextAttribute.FontNameHelper.FontType.Helvetica);
-            fontTypes.add(CPDFTextAttribute.FontNameHelper.FontType.Times_Roman);
-            fontSpinnerAdapter = new CExternFontSpinnerAdapter(getContext(), fontTypes, CPDFSysFontUtils.GetSysFontName());
-            fontSpinner.setAdapter(fontSpinnerAdapter);
-
-            String externFontName = annotStyle.getExternFontName();
-            if (TextUtils.isEmpty(externFontName)) {
-                switch (annotStyle.getFontType()) {
-                    case Unknown:
-                        fontSpinner.setSelection(0);
-                        break;
-                    case Courier:
-                        fontSpinner.setSelection(1);
-                        break;
-                    case Helvetica:
-                        fontSpinner.setSelection(2);
-                        break;
-                    case Times_Roman:
-                        fontSpinner.setSelection(3);
-                        break;
-                    default:
-                        break;
-                }
+
+            if (!TextUtils.isEmpty(annotStyle.getExternFontName())) {
+                fontView.initFont(annotStyle.getExternFontName(), annotStyle.isFontBold(), annotStyle.isFontItalic());
             } else {
-                List<String> fontNameList = CPDFSysFontUtils.GetSysFontName();
-                if (fontNameList != null) {
-                    for (int i = 0; i < fontNameList.size(); i++) {
-                        if (fontNameList.get(i).contains(externFontName)) {
-                            fontSpinner.setSelection(fontSpinnerAdapter.getStandardFontCount() + i);
-                            break;
-                        }
-                    }
-                }
+                fontView.initFont(annotStyle.getFontType().name(), annotStyle.isFontBold(), annotStyle.isFontItalic());
             }
 
             colorListView.setSelectColor(annotStyle.getTextColor());
             opacitySliderBar.setProgress(annotStyle.getTextColorOpacity());
-            tvFontBold.setSelected(annotStyle.isFontBold());
-            tvFontItalic.setSelected(annotStyle.isFontItalic());
             switch (annotStyle.getAlignment()) {
                 case LEFT:
                     selectAlignmentView(ivAlignmentLeft);
@@ -175,7 +124,7 @@ public class CEditTextProperFragment extends CBasicPropertiesFragment
         colorListView.setOnColorSelectListener(this::color);
         colorListView.setColorPickerClickListener(() -> {
             CAnnotStyle cAnnotStyle = viewModel.getStyle();
-            showFragment(CStyleFragmentDatas.colorPicker(), (CColorPickerFragment colorPickerFragment)->{
+            showFragment(CStyleFragmentDatas.colorPicker(), (CColorPickerFragment colorPickerFragment) -> {
                 colorPickerFragment.initColor(cAnnotStyle.getTextColor(), cAnnotStyle.getTextColorOpacity());
                 colorPickerFragment.setColorPickerListener(this);
                 colorPickerFragment.setColorAlphaChangeListener(this);
@@ -197,51 +146,42 @@ public class CEditTextProperFragment extends CBasicPropertiesFragment
                 setUpdatePropertyType(CAnnotStyle.EditUpdatePropertyType.FontSize);
                 viewModel.getStyle().setFontSize(progress);
                 setUpdatePropertyType(CAnnotStyle.EditUpdatePropertyType.All);
-            } else if (isStop == false){
+            } else if (isStop == false) {
                 this.onChangeFontSize(progress);
             }
         });
         viewModel.addStyleChangeListener(this);
-        fontSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
+        fontView.setFontChangeListener(new CPDFFontView.CFontChangeListener() {
             @Override
-            public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
+            public void font(CPDFTextAttribute.FontNameHelper.FontType fontType, String outFontName) {
                 if (viewModel != null) {
                     setUpdatePropertyType(CAnnotStyle.EditUpdatePropertyType.FontType);
-                    if (position < fontSpinnerAdapter.getStandardFontCount()) {
-                        CPDFTextAttribute.FontNameHelper.FontType fontType = (CPDFTextAttribute.FontNameHelper.FontType) fontSpinner.getItemAtPosition(position);
-                        viewModel.getStyle().setFontType(fontType);
+                    if (!TextUtils.isEmpty(outFontName)) {
+                        viewModel.getStyle().setExternFontName(outFontName);
                     } else {
-                        String fontName = (String) fontSpinner.getItemAtPosition(position);
-                        viewModel.getStyle().setExternFontName(fontName);
+                        viewModel.getStyle().setFontType(fontType);
                     }
                     setUpdatePropertyType(CAnnotStyle.EditUpdatePropertyType.All);
                 }
             }
 
             @Override
-            public void onNothingSelected(AdapterView<?> parent) {
-
+            public void fontStyle(boolean bold, boolean italic) {
+                if (viewModel != null) {
+                    setUpdatePropertyType(CAnnotStyle.EditUpdatePropertyType.Bold);
+                    viewModel.getStyle().setFontBold(bold);
+                    setUpdatePropertyType(CAnnotStyle.EditUpdatePropertyType.All);
+                    setUpdatePropertyType(CAnnotStyle.EditUpdatePropertyType.Italic);
+                    viewModel.getStyle().setFontItalic(italic);
+                    setUpdatePropertyType(CAnnotStyle.EditUpdatePropertyType.All);
+                }
             }
         });
     }
 
     @Override
     public void onClick(View v) {
-        if (v.getId() == R.id.iv_font_bold) {
-            tvFontBold.setSelected(!tvFontBold.isSelected());
-            if (viewModel != null) {
-                setUpdatePropertyType(CAnnotStyle.EditUpdatePropertyType.Bold);
-                viewModel.getStyle().setFontBold(tvFontBold.isSelected());
-                setUpdatePropertyType(CAnnotStyle.EditUpdatePropertyType.All);
-            }
-        } else if (v.getId() == R.id.iv_font_italic) {
-            tvFontItalic.setSelected(!tvFontItalic.isSelected());
-            if (viewModel != null) {
-                setUpdatePropertyType(CAnnotStyle.EditUpdatePropertyType.Italic);
-                viewModel.getStyle().setFontItalic(tvFontItalic.isSelected());
-                setUpdatePropertyType(CAnnotStyle.EditUpdatePropertyType.All);
-            }
-        } else if (v.getId() == R.id.iv_alignment_left) {
+         if (v.getId() == R.id.iv_alignment_left) {
             selectAlignmentView(ivAlignmentLeft);
             setAlignment(CAnnotStyle.Alignment.LEFT);
         } else if (v.getId() == R.id.iv_alignment_center) {
@@ -253,13 +193,13 @@ public class CEditTextProperFragment extends CBasicPropertiesFragment
         }
     }
 
-    private void selectAlignmentView(AppCompatImageView alignmentView){
+    private void selectAlignmentView(AppCompatImageView alignmentView) {
         for (View view : alignmentViews) {
             view.setSelected(view == alignmentView);
         }
     }
 
-    private void setAlignment(CAnnotStyle.Alignment alignment){
+    private void setAlignment(CAnnotStyle.Alignment alignment) {
         if (viewModel != null) {
             setUpdatePropertyType(CAnnotStyle.EditUpdatePropertyType.Alignment);
             viewModel.getStyle().setAlignment(alignment);
@@ -318,18 +258,7 @@ public class CEditTextProperFragment extends CBasicPropertiesFragment
     @Override
     public void onChangeAnnotExternFontType(String fontName) {
         if (previewView != null) {
-            List<String> fontList = CPDFSysFontUtils.getSysFontPathList();
-            String font = "";
-            for (String item : fontList) {
-                if (TextUtils.isEmpty(item)) {
-                    continue;
-                }
-                if (item.contains(fontName + ".")) {
-                    font = item;
-                    break;
-                }
-            }
-            previewView.setExternFontType(font);
+            previewView.setExternFontType(fontName);
         }
     }
 

+ 20 - 52
ComPDFKit_Tools/src/main/java/com/compdfkit/tools/forms/pdfproperties/pdflistbox/CListBoxStyleFragment.java

@@ -14,12 +14,9 @@ import android.text.TextUtils;
 import android.view.LayoutInflater;
 import android.view.View;
 import android.view.ViewGroup;
-import android.widget.AdapterView;
-import android.widget.Spinner;
 
 import androidx.annotation.NonNull;
 import androidx.annotation.Nullable;
-import androidx.appcompat.widget.AppCompatImageView;
 
 import com.compdfkit.core.annotation.CPDFTextAttribute;
 import com.compdfkit.tools.R;
@@ -28,14 +25,11 @@ import com.compdfkit.tools.common.utils.view.sliderbar.CSliderBar;
 import com.compdfkit.tools.common.views.pdfproperties.CPropertiesSwitchView;
 import com.compdfkit.tools.common.views.pdfproperties.basic.CBasicPropertiesFragment;
 import com.compdfkit.tools.common.views.pdfproperties.colorlist.ColorListView;
-import com.compdfkit.tools.common.views.pdfproperties.font.CFontSpinnerAdapter;
+import com.compdfkit.tools.common.views.pdfproperties.font.CPDFFontView;
 import com.compdfkit.tools.common.views.pdfproperties.pdfstyle.CAnnotStyle;
 import com.compdfkit.tools.common.views.pdfproperties.pdfstyle.CStyleFragmentDatas;
 import com.compdfkit.tools.common.views.pdfproperties.textfields.CTextFieldsView;
 
-import java.util.ArrayList;
-import java.util.List;
-
 
 public class CListBoxStyleFragment extends CBasicPropertiesFragment implements View.OnClickListener{
 
@@ -51,15 +45,11 @@ public class CListBoxStyleFragment extends CBasicPropertiesFragment implements V
 
     private ColorListView textColorListView;
 
-    private AppCompatImageView ivFontItalic;
-
-    private AppCompatImageView ivFontBold;
-
     private CPropertiesSwitchView hideFormSwitch;
 
     private CSliderBar fontSizeSliderBar;
 
-    private Spinner fontSpinner;
+    private CPDFFontView fontView;
 
     @Nullable
     @Override
@@ -69,13 +59,9 @@ public class CListBoxStyleFragment extends CBasicPropertiesFragment implements V
         borderColorListView = rootView.findViewById(R.id.border_color_list_view);
         backgroundColorListView = rootView.findViewById(R.id.background_color_list_view);
         textColorListView = rootView.findViewById(R.id.text_color_list_view);
-        ivFontItalic = rootView.findViewById(R.id.iv_font_italic);
-        ivFontBold = rootView.findViewById(R.id.iv_font_bold);
+        fontView = rootView.findViewById(R.id.font_view);
         fontSizeSliderBar = rootView.findViewById(R.id.font_size_slider_bar);
-        fontSpinner = rootView.findViewById(R.id.spinner_font);
         hideFormSwitch = rootView.findViewById(R.id.switch_hide_form);
-        ivFontItalic.setOnClickListener(this);
-        ivFontBold.setOnClickListener(this);
         return rootView;
     }
 
@@ -84,29 +70,15 @@ public class CListBoxStyleFragment extends CBasicPropertiesFragment implements V
         super.onViewCreated(view, savedInstanceState);
         CAnnotStyle annotStyle = viewModel.getStyle();
         if (annotStyle != null) {
-            List<CPDFTextAttribute.FontNameHelper.FontType> fontTypes = new ArrayList<>();
-            fontTypes.add(CPDFTextAttribute.FontNameHelper.FontType.Helvetica);
-            fontTypes.add(CPDFTextAttribute.FontNameHelper.FontType.Courier);
-            fontTypes.add(CPDFTextAttribute.FontNameHelper.FontType.Times_Roman);
-            CFontSpinnerAdapter fontSpinnerAdapter = new CFontSpinnerAdapter(getContext(), fontTypes);
-            fontSpinner.setAdapter(fontSpinnerAdapter);
-            switch (annotStyle.getFontType()) {
-                case Courier:
-                    fontSpinner.setSelection(1);
-                    break;
-                case Times_Roman:
-                    fontSpinner.setSelection(2);
-                    break;
-                default:
-                    fontSpinner.setSelection(0);
-                    break;
+            if (!TextUtils.isEmpty(annotStyle.getExternFontName())) {
+                fontView.initFont(annotStyle.getExternFontName(), annotStyle.isFontBold(), annotStyle.isFontItalic());
+            } else {
+                fontView.initFont(annotStyle.getFontType().name(), annotStyle.isFontBold(), annotStyle.isFontItalic());
             }
             textFieldsView.setText(annotStyle.getFormFieldName());
             borderColorListView.setSelectColor(annotStyle.getLineColor());
             backgroundColorListView.setSelectColor(annotStyle.getFillColor());
             textColorListView.setSelectColor(annotStyle.getTextColor());
-            ivFontBold.setSelected(annotStyle.isFontBold());
-            ivFontItalic.setSelected(annotStyle.isFontItalic());
             hideFormSwitch.setChecked(annotStyle.isHideForm());
             fontSizeSliderBar.setProgress(annotStyle.getFontSize());
         }
@@ -169,18 +141,24 @@ public class CListBoxStyleFragment extends CBasicPropertiesFragment implements V
                 }
             }
         });
-        fontSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
+        fontView.setFontChangeListener(new CPDFFontView.CFontChangeListener() {
             @Override
-            public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
+            public void font(CPDFTextAttribute.FontNameHelper.FontType fontType, String outFontName) {
                 if (viewModel != null) {
-                    CPDFTextAttribute.FontNameHelper.FontType fontType = (CPDFTextAttribute.FontNameHelper.FontType) fontSpinner.getItemAtPosition(position);
-                    viewModel.getStyle().setFontType(fontType);
+                    if (!TextUtils.isEmpty(outFontName)) {
+                        viewModel.getStyle().setExternFontName(outFontName);
+                    }else {
+                        viewModel.getStyle().setFontType(fontType);
+                    }
                 }
             }
 
             @Override
-            public void onNothingSelected(AdapterView<?> parent) {
-
+            public void fontStyle(boolean bold, boolean italic) {
+                if (viewModel != null){
+                    viewModel.getStyle().setFontBold(bold);
+                    viewModel.getStyle().setFontItalic(italic);
+                }
             }
         });
         textFieldsView.setTextChangedListener((s, start, before, count) -> {
@@ -201,17 +179,7 @@ public class CListBoxStyleFragment extends CBasicPropertiesFragment implements V
 
     @Override
     public void onClick(View v) {
-        if (v.getId() == R.id.iv_font_bold) {
-            ivFontBold.setSelected(!ivFontBold.isSelected());
-            if (viewModel != null) {
-                viewModel.getStyle().setFontBold(ivFontBold.isSelected());
-            }
-        } else if (v.getId() == R.id.iv_font_italic) {
-            ivFontItalic.setSelected(!ivFontItalic.isSelected());
-            if (viewModel != null) {
-                viewModel.getStyle().setFontItalic(ivFontItalic.isSelected());
-            }
-        } else {}
+
     }
 
     @Override

+ 19 - 53
ComPDFKit_Tools/src/main/java/com/compdfkit/tools/forms/pdfproperties/pdfpushbutton/CPushButtonStyleFragment.java

@@ -16,13 +16,10 @@ import android.text.TextWatcher;
 import android.view.LayoutInflater;
 import android.view.View;
 import android.view.ViewGroup;
-import android.widget.AdapterView;
-import android.widget.Spinner;
 
 import androidx.annotation.NonNull;
 import androidx.annotation.Nullable;
 import androidx.appcompat.widget.AppCompatEditText;
-import androidx.appcompat.widget.AppCompatImageView;
 
 import com.compdfkit.core.annotation.CPDFTextAttribute;
 import com.compdfkit.tools.R;
@@ -31,14 +28,11 @@ import com.compdfkit.tools.common.utils.view.sliderbar.CSliderBar;
 import com.compdfkit.tools.common.views.pdfproperties.CPropertiesSwitchView;
 import com.compdfkit.tools.common.views.pdfproperties.basic.CBasicPropertiesFragment;
 import com.compdfkit.tools.common.views.pdfproperties.colorlist.ColorListView;
-import com.compdfkit.tools.common.views.pdfproperties.font.CFontSpinnerAdapter;
+import com.compdfkit.tools.common.views.pdfproperties.font.CPDFFontView;
 import com.compdfkit.tools.common.views.pdfproperties.pdfstyle.CAnnotStyle;
 import com.compdfkit.tools.common.views.pdfproperties.pdfstyle.CStyleFragmentDatas;
 import com.compdfkit.tools.common.views.pdfproperties.textfields.CTextFieldsView;
 
-import java.util.ArrayList;
-import java.util.List;
-
 
 public class CPushButtonStyleFragment extends CBasicPropertiesFragment implements View.OnClickListener{
 
@@ -56,15 +50,11 @@ public class CPushButtonStyleFragment extends CBasicPropertiesFragment implement
 
     private ColorListView textColorListView;
 
-    private AppCompatImageView ivFontItalic;
-
-    private AppCompatImageView ivFontBold;
-
     private CPropertiesSwitchView hideFormSwitch;
 
     private CSliderBar fontSizeSliderBar;
 
-    private Spinner fontSpinner;
+    private CPDFFontView fontView;
 
     @Nullable
     @Override
@@ -75,13 +65,9 @@ public class CPushButtonStyleFragment extends CBasicPropertiesFragment implement
         borderColorListView = rootView.findViewById(R.id.border_color_list_view);
         backgroundColorListView = rootView.findViewById(R.id.background_color_list_view);
         textColorListView = rootView.findViewById(R.id.text_color_list_view);
-        ivFontItalic = rootView.findViewById(R.id.iv_font_italic);
-        ivFontBold = rootView.findViewById(R.id.iv_font_bold);
         fontSizeSliderBar = rootView.findViewById(R.id.font_size_slider_bar);
-        fontSpinner = rootView.findViewById(R.id.spinner_font);
+        fontView = rootView.findViewById(R.id.font_view);
         hideFormSwitch = rootView.findViewById(R.id.switch_hide_form);
-        ivFontItalic.setOnClickListener(this);
-        ivFontBold.setOnClickListener(this);
         return rootView;
     }
 
@@ -90,30 +76,15 @@ public class CPushButtonStyleFragment extends CBasicPropertiesFragment implement
         super.onViewCreated(view, savedInstanceState);
         CAnnotStyle annotStyle = viewModel.getStyle();
         if (annotStyle != null) {
-            List<CPDFTextAttribute.FontNameHelper.FontType> fontTypes = new ArrayList<>();
-            fontTypes.add(CPDFTextAttribute.FontNameHelper.FontType.Helvetica);
-            fontTypes.add(CPDFTextAttribute.FontNameHelper.FontType.Courier);
-            fontTypes.add(CPDFTextAttribute.FontNameHelper.FontType.Times_Roman);
-            CFontSpinnerAdapter fontSpinnerAdapter = new CFontSpinnerAdapter(getContext(), fontTypes);
-            fontSpinner.setAdapter(fontSpinnerAdapter);
-            switch (annotStyle.getFontType()) {
-
-                case Courier:
-                    fontSpinner.setSelection(1);
-                    break;
-                case Times_Roman:
-                    fontSpinner.setSelection(2);
-                    break;
-                default:
-                    fontSpinner.setSelection(0);
-                    break;
+            if (!TextUtils.isEmpty(annotStyle.getExternFontName())) {
+                fontView.initFont(annotStyle.getExternFontName(), annotStyle.isFontBold(), annotStyle.isFontItalic());
+            } else {
+                fontView.initFont(annotStyle.getFontType().name(), annotStyle.isFontBold(), annotStyle.isFontItalic());
             }
             textFieldsView.setText(annotStyle.getFormFieldName());
             borderColorListView.setSelectColor(annotStyle.getLineColor());
             backgroundColorListView.setSelectColor(annotStyle.getFillColor());
             textColorListView.setSelectColor(annotStyle.getTextColor());
-            ivFontBold.setSelected(annotStyle.isFontBold());
-            ivFontItalic.setSelected(annotStyle.isFontItalic());
             hideFormSwitch.setChecked(annotStyle.isHideForm());
             fontSizeSliderBar.setProgress(annotStyle.getFontSize());
             etBtnText.setText(annotStyle.getFormDefaultValue());
@@ -177,18 +148,24 @@ public class CPushButtonStyleFragment extends CBasicPropertiesFragment implement
                 }
             }
         });
-        fontSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
+        fontView.setFontChangeListener(new CPDFFontView.CFontChangeListener() {
             @Override
-            public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
+            public void font(CPDFTextAttribute.FontNameHelper.FontType fontType, String outFontName) {
                 if (viewModel != null) {
-                    CPDFTextAttribute.FontNameHelper.FontType fontType = (CPDFTextAttribute.FontNameHelper.FontType) fontSpinner.getItemAtPosition(position);
-                    viewModel.getStyle().setFontType(fontType);
+                    if (!TextUtils.isEmpty(outFontName)) {
+                        viewModel.getStyle().setExternFontName(outFontName);
+                    }else {
+                        viewModel.getStyle().setFontType(fontType);
+                    }
                 }
             }
 
             @Override
-            public void onNothingSelected(AdapterView<?> parent) {
-
+            public void fontStyle(boolean bold, boolean italic) {
+                if (viewModel != null){
+                    viewModel.getStyle().setFontBold(bold);
+                    viewModel.getStyle().setFontItalic(italic);
+                }
             }
         });
         textFieldsView.setTextChangedListener((s, start, before, count) -> {
@@ -231,17 +208,6 @@ public class CPushButtonStyleFragment extends CBasicPropertiesFragment implement
 
     @Override
     public void onClick(View v) {
-        if (v.getId() == R.id.iv_font_bold) {
-            ivFontBold.setSelected(!ivFontBold.isSelected());
-            if (viewModel != null) {
-                viewModel.getStyle().setFontBold(ivFontBold.isSelected());
-            }
-        } else if (v.getId() == R.id.iv_font_italic) {
-            ivFontItalic.setSelected(!ivFontItalic.isSelected());
-            if (viewModel != null) {
-                viewModel.getStyle().setFontItalic(ivFontItalic.isSelected());
-            }
-        } else {}
     }
 
     @Override

+ 20 - 48
ComPDFKit_Tools/src/main/java/com/compdfkit/tools/forms/pdfproperties/pdftextfield/CTextFieldStyleFragment.java

@@ -16,9 +16,7 @@ import android.text.TextWatcher;
 import android.view.LayoutInflater;
 import android.view.View;
 import android.view.ViewGroup;
-import android.widget.AdapterView;
 import android.widget.LinearLayout;
-import android.widget.Spinner;
 
 import androidx.annotation.NonNull;
 import androidx.annotation.Nullable;
@@ -32,7 +30,7 @@ import com.compdfkit.tools.common.utils.view.sliderbar.CSliderBar;
 import com.compdfkit.tools.common.views.pdfproperties.CPropertiesSwitchView;
 import com.compdfkit.tools.common.views.pdfproperties.basic.CBasicPropertiesFragment;
 import com.compdfkit.tools.common.views.pdfproperties.colorlist.ColorListView;
-import com.compdfkit.tools.common.views.pdfproperties.font.CFontSpinnerAdapter;
+import com.compdfkit.tools.common.views.pdfproperties.font.CPDFFontView;
 import com.compdfkit.tools.common.views.pdfproperties.pdfstyle.CAnnotStyle;
 import com.compdfkit.tools.common.views.pdfproperties.pdfstyle.CStyleFragmentDatas;
 import com.compdfkit.tools.common.views.pdfproperties.textfields.CTextFieldsView;
@@ -57,10 +55,6 @@ public class CTextFieldStyleFragment extends CBasicPropertiesFragment implements
 
     private ColorListView textColorListView;
 
-    private AppCompatImageView ivFontItalic;
-
-    private AppCompatImageView ivFontBold;
-
     private LinearLayout llAlignment;
 
     private AppCompatImageView ivAlignmentLeft;
@@ -75,7 +69,7 @@ public class CTextFieldStyleFragment extends CBasicPropertiesFragment implements
 
     private CSliderBar fontSizeSliderBar;
 
-    private Spinner fontSpinner;
+    private CPDFFontView fontView;
 
     private List<View> alignmentViews = new ArrayList<>();
 
@@ -87,19 +81,15 @@ public class CTextFieldStyleFragment extends CBasicPropertiesFragment implements
         borderColorListView = rootView.findViewById(R.id.border_color_list_view);
         backgroundColorListView = rootView.findViewById(R.id.background_color_list_view);
         textColorListView = rootView.findViewById(R.id.text_color_list_view);
-        ivFontItalic = rootView.findViewById(R.id.iv_font_italic);
-        ivFontBold = rootView.findViewById(R.id.iv_font_bold);
         llAlignment = rootView.findViewById(R.id.ll_alignment_type);
         ivAlignmentLeft = rootView.findViewById(R.id.iv_alignment_left);
         ivAlignmentCenter = rootView.findViewById(R.id.iv_alignment_center);
         ivAlignmentRight = rootView.findViewById(R.id.iv_alignment_right);
         fontSizeSliderBar = rootView.findViewById(R.id.font_size_slider_bar);
-        fontSpinner = rootView.findViewById(R.id.spinner_font);
         etDefaultValue = rootView.findViewById(R.id.et_default_value);
         hideFormSwitch = rootView.findViewById(R.id.switch_hide_form);
         multiLineSwitch = rootView.findViewById(R.id.switch_multi_line);
-        ivFontItalic.setOnClickListener(this);
-        ivFontBold.setOnClickListener(this);
+        fontView = rootView.findViewById(R.id.font_view);
         ivAlignmentLeft.setOnClickListener(this);
         ivAlignmentCenter.setOnClickListener(this);
         ivAlignmentRight.setOnClickListener(this);
@@ -114,29 +104,15 @@ public class CTextFieldStyleFragment extends CBasicPropertiesFragment implements
         super.onViewCreated(view, savedInstanceState);
         CAnnotStyle annotStyle = viewModel.getStyle();
         if (annotStyle != null) {
-            List<CPDFTextAttribute.FontNameHelper.FontType> fontTypes = new ArrayList<>();
-            fontTypes.add(CPDFTextAttribute.FontNameHelper.FontType.Helvetica);
-            fontTypes.add(CPDFTextAttribute.FontNameHelper.FontType.Courier);
-            fontTypes.add(CPDFTextAttribute.FontNameHelper.FontType.Times_Roman);
-            CFontSpinnerAdapter fontSpinnerAdapter = new CFontSpinnerAdapter(getContext(), fontTypes);
-            fontSpinner.setAdapter(fontSpinnerAdapter);
-            switch (annotStyle.getFontType()) {
-                case Courier:
-                    fontSpinner.setSelection(1);
-                    break;
-                case Times_Roman:
-                    fontSpinner.setSelection(2);
-                    break;
-                default:
-                    fontSpinner.setSelection(0);
-                    break;
+            if (!TextUtils.isEmpty(annotStyle.getExternFontName())) {
+                fontView.initFont(annotStyle.getExternFontName(), annotStyle.isFontBold(), annotStyle.isFontItalic());
+            } else {
+                fontView.initFont(annotStyle.getFontType().name(), annotStyle.isFontBold(), annotStyle.isFontItalic());
             }
             textFieldsView.setText(annotStyle.getFormFieldName());
             borderColorListView.setSelectColor(annotStyle.getLineColor());
             backgroundColorListView.setSelectColor(annotStyle.getFillColor());
             textColorListView.setSelectColor(annotStyle.getTextColor());
-            ivFontBold.setSelected(annotStyle.isFontBold());
-            ivFontItalic.setSelected(annotStyle.isFontItalic());
             hideFormSwitch.setChecked(annotStyle.isHideForm());
             multiLineSwitch.setChecked(annotStyle.isFormMultiLine());
             etDefaultValue.setText(annotStyle.getFormDefaultValue());
@@ -215,18 +191,24 @@ public class CTextFieldStyleFragment extends CBasicPropertiesFragment implements
                 }
             }
         });
-        fontSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
+        fontView.setFontChangeListener(new CPDFFontView.CFontChangeListener() {
             @Override
-            public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
+            public void font(CPDFTextAttribute.FontNameHelper.FontType fontType, String outFontName) {
                 if (viewModel != null) {
-                    CPDFTextAttribute.FontNameHelper.FontType fontType = (CPDFTextAttribute.FontNameHelper.FontType) fontSpinner.getItemAtPosition(position);
-                    viewModel.getStyle().setFontType(fontType);
+                    if (!TextUtils.isEmpty(outFontName)) {
+                        viewModel.getStyle().setExternFontName(outFontName);
+                    }else {
+                        viewModel.getStyle().setFontType(fontType);
+                    }
                 }
             }
 
             @Override
-            public void onNothingSelected(AdapterView<?> parent) {
-
+            public void fontStyle(boolean bold, boolean italic) {
+                if (viewModel != null){
+                    viewModel.getStyle().setFontBold(bold);
+                    viewModel.getStyle().setFontItalic(italic);
+                }
             }
         });
         textFieldsView.setTextChangedListener((s, start, before, count) -> {
@@ -274,17 +256,7 @@ public class CTextFieldStyleFragment extends CBasicPropertiesFragment implements
 
     @Override
     public void onClick(View v) {
-        if (v.getId() == R.id.iv_font_bold) {
-            ivFontBold.setSelected(!ivFontBold.isSelected());
-            if (viewModel != null) {
-                viewModel.getStyle().setFontBold(ivFontBold.isSelected());
-            }
-        } else if (v.getId() == R.id.iv_font_italic) {
-            ivFontItalic.setSelected(!ivFontItalic.isSelected());
-            if (viewModel != null) {
-                viewModel.getStyle().setFontItalic(ivFontItalic.isSelected());
-            }
-        } else if (v.getId() == R.id.iv_alignment_left) {
+        if (v.getId() == R.id.iv_alignment_left) {
             selectAlignmentView(ivAlignmentLeft);
             setAlignment(CAnnotStyle.Alignment.LEFT);
         } else if (v.getId() == R.id.iv_alignment_center) {

+ 24 - 47
ComPDFKit_Tools/src/main/java/com/compdfkit/tools/security/watermark/pdfproperties/CWatermarkTextStyleFragment.java

@@ -11,6 +11,7 @@ package com.compdfkit.tools.security.watermark.pdfproperties;
 
 
 import android.os.Bundle;
+import android.text.TextUtils;
 import android.view.LayoutInflater;
 import android.view.View;
 import android.view.ViewGroup;
@@ -29,11 +30,10 @@ import com.compdfkit.tools.common.utils.view.colorpicker.widget.ColorPickerView;
 import com.compdfkit.tools.common.utils.view.sliderbar.CSliderBar;
 import com.compdfkit.tools.common.views.pdfproperties.basic.CBasicPropertiesFragment;
 import com.compdfkit.tools.common.views.pdfproperties.colorlist.ColorListView;
-import com.compdfkit.tools.common.views.pdfproperties.font.CFontSpinnerAdapter;
+import com.compdfkit.tools.common.views.pdfproperties.font.CPDFFontView;
 import com.compdfkit.tools.common.views.pdfproperties.pdfstyle.CAnnotStyle;
 import com.compdfkit.tools.common.views.pdfproperties.pdfstyle.CStyleFragmentDatas;
 
-import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
 import java.util.Map;
@@ -45,13 +45,9 @@ public class CWatermarkTextStyleFragment extends CBasicPropertiesFragment implem
 
     private CSliderBar opacitySliderBar;
 
-    private AppCompatImageView ivFontItalic;
-
-    private AppCompatImageView ivFontBold;
-
     private CSliderBar fontSizeSliderBar;
 
-    private Spinner fontSpinner;
+    private CPDFFontView fontView;
 
     private Spinner pageRangeSpinner;
 
@@ -67,16 +63,12 @@ public class CWatermarkTextStyleFragment extends CBasicPropertiesFragment implem
         View rootView = inflater.inflate(R.layout.tools_cpdf_security_watermark_text_style_fragment, container, false);
         colorListView = rootView.findViewById(R.id.border_color_list_view);
         opacitySliderBar = rootView.findViewById(R.id.slider_bar);
-        ivFontItalic = rootView.findViewById(R.id.iv_font_italic);
-        ivFontBold = rootView.findViewById(R.id.iv_font_bold);
         fontSizeSliderBar = rootView.findViewById(R.id.font_size_slider_bar);
-        fontSpinner = rootView.findViewById(R.id.spinner_font);
+        fontView = rootView.findViewById(R.id.font_view);
         swTile = rootView.findViewById(R.id.sw_tile);
         pageRangeSpinner = rootView.findViewById(R.id.spinner_page_range);
         ivLocationTop = rootView.findViewById(R.id.iv_location_top);
         ivLocationBottom = rootView.findViewById(R.id.iv_location_bottom);
-        ivFontItalic.setOnClickListener(this);
-        ivFontBold.setOnClickListener(this);
         ivLocationTop.setOnClickListener(this);
         ivLocationBottom.setOnClickListener(this);
         return rootView;
@@ -87,23 +79,12 @@ public class CWatermarkTextStyleFragment extends CBasicPropertiesFragment implem
         super.onViewCreated(view, savedInstanceState);
         CAnnotStyle annotStyle = viewModel.getStyle();
         if (annotStyle != null) {
-            List<CPDFTextAttribute.FontNameHelper.FontType> fontTypes = new ArrayList<>();
-            fontTypes.add(CPDFTextAttribute.FontNameHelper.FontType.Helvetica);
-            fontTypes.add(CPDFTextAttribute.FontNameHelper.FontType.Courier);
-            fontTypes.add(CPDFTextAttribute.FontNameHelper.FontType.Times_Roman);
-            CFontSpinnerAdapter fontSpinnerAdapter = new CFontSpinnerAdapter(getContext(), fontTypes);
-            fontSpinner.setAdapter(fontSpinnerAdapter);
-            switch (annotStyle.getFontType()) {
-                case Courier:
-                    fontSpinner.setSelection(1);
-                    break;
-                case Times_Roman:
-                    fontSpinner.setSelection(2);
-                    break;
-                default:
-                    fontSpinner.setSelection(0);
-                    break;
+            if (!TextUtils.isEmpty(annotStyle.getExternFontName())) {
+                fontView.initFont(annotStyle.getExternFontName(), annotStyle.isFontBold(), annotStyle.isFontItalic());
+            } else {
+                fontView.initFont(annotStyle.getFontType().name(), annotStyle.isFontBold(), annotStyle.isFontItalic());
             }
+
             Map<String, Object> extraMap = annotStyle.getCustomExtraMap();
             CPageRange pageRange = CPageRange.AllPages;
             if (extraMap.containsKey("pageRange")){
@@ -134,8 +115,6 @@ public class CWatermarkTextStyleFragment extends CBasicPropertiesFragment implem
 
             colorListView.setSelectColor(annotStyle.getTextColor());
             opacitySliderBar.setProgress(annotStyle.getTextColorOpacity());
-            ivFontBold.setSelected(annotStyle.isFontBold());
-            ivFontItalic.setSelected(annotStyle.isFontItalic());
             fontSizeSliderBar.setProgress(annotStyle.getFontSize());
             fontSizeSliderBar.setSliderBarMinValue(10);
             swTile.setChecked(annotStyle.isChecked());
@@ -162,20 +141,28 @@ public class CWatermarkTextStyleFragment extends CBasicPropertiesFragment implem
             }
         });
         viewModel.addStyleChangeListener(this);
-        fontSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
+
+        fontView.setFontChangeListener(new CPDFFontView.CFontChangeListener() {
             @Override
-            public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
+            public void font(CPDFTextAttribute.FontNameHelper.FontType fontType, String outFontName) {
                 if (viewModel != null) {
-                    CPDFTextAttribute.FontNameHelper.FontType fontType = (CPDFTextAttribute.FontNameHelper.FontType) fontSpinner.getItemAtPosition(position);
-                    viewModel.getStyle().setFontType(fontType);
+                    if (!TextUtils.isEmpty(outFontName)) {
+                        viewModel.getStyle().setExternFontName(outFontName);
+                    } else {
+                        viewModel.getStyle().setFontType(fontType);
+                    }
                 }
             }
 
             @Override
-            public void onNothingSelected(AdapterView<?> parent) {
-
+            public void fontStyle(boolean bold, boolean italic) {
+                if (viewModel != null) {
+                    viewModel.getStyle().setFontBold(bold);
+                    viewModel.getStyle().setFontItalic(italic);
+                }
             }
         });
+
         swTile.setOnCheckedChangeListener((buttonView, isChecked) -> {
             if (viewModel != null && viewModel.getStyle() != null) {
                 viewModel.getStyle().setChecked(isChecked);
@@ -199,17 +186,7 @@ public class CWatermarkTextStyleFragment extends CBasicPropertiesFragment implem
 
     @Override
     public void onClick(View v) {
-        if (v.getId() == R.id.iv_font_bold) {
-            ivFontBold.setSelected(!ivFontBold.isSelected());
-            if (viewModel != null) {
-                viewModel.getStyle().setFontBold(ivFontBold.isSelected());
-            }
-        } else if (v.getId() == R.id.iv_font_italic) {
-            ivFontItalic.setSelected(!ivFontItalic.isSelected());
-            if (viewModel != null) {
-                viewModel.getStyle().setFontItalic(ivFontItalic.isSelected());
-            }
-        } else if (v.getId() == R.id.iv_location_top) {
+        if (v.getId() == R.id.iv_location_top) {
             ivLocationTop.setSelected(true);
             ivLocationBottom.setSelected(false);
             if (viewModel != null && viewModel.getStyle() != null) {

+ 3 - 10
ComPDFKit_Tools/src/main/java/com/compdfkit/tools/signature/importcert/create/CPDFSelectDigitalSignatureDialog.java

@@ -12,11 +12,9 @@ package com.compdfkit.tools.signature.importcert.create;
 
 import static com.compdfkit.tools.common.utils.CFileUtils.CERTIFICATE_DIGITAL_TYPE;
 
-import android.Manifest;
 import android.content.Intent;
 import android.content.pm.ActivityInfo;
 import android.net.Uri;
-import android.os.Build;
 import android.os.Bundle;
 import android.view.LayoutInflater;
 import android.view.View;
@@ -34,7 +32,6 @@ import androidx.fragment.app.Fragment;
 import com.compdfkit.tools.R;
 import com.compdfkit.tools.annotation.pdfproperties.pdfsignature.CAddSignatureActivity;
 import com.compdfkit.tools.common.utils.CFileUtils;
-import com.compdfkit.tools.common.utils.CPermissionUtil;
 import com.compdfkit.tools.signature.interfaces.COnSelectCertFileListener;
 
 public class CPDFSelectDigitalSignatureDialog extends DialogFragment implements View.OnClickListener {
@@ -47,10 +44,6 @@ public class CPDFSelectDigitalSignatureDialog extends DialogFragment implements
 
     private COnCertDigitalSignListener certDigitalSignListener;
 
-    private ActivityResultLauncher<String> requestStorageLauncher = registerForActivityResult(new ActivityResultContracts.RequestPermission(), result -> {
-
-    });
-
     private ActivityResultLauncher<Intent> addSignatureLauncher = registerForActivityResult(new ActivityResultContracts.StartActivityForResult(), result -> {
         Fragment fragment = getChildFragmentManager().findFragmentByTag("certDialog");
         if (fragment != null) {
@@ -63,8 +56,7 @@ public class CPDFSelectDigitalSignatureDialog extends DialogFragment implements
                 if (certDigitalSignListener != null) {
                     certDigitalSignListener.sign(certFilePath,certPassword, signImagePath);
                 }
-            }else if (result.getData().getBooleanExtra(CAddSignatureActivity.RESULT_NONE, false)){
-                //none
+            } else if (result.getData().getBooleanExtra(CAddSignatureActivity.RESULT_NONE, false)){
                 signImagePath = "";
                 if (certDigitalSignListener != null) {
                     certDigitalSignListener.sign(certFilePath,certPassword, signImagePath);
@@ -84,6 +76,7 @@ public class CPDFSelectDigitalSignatureDialog extends DialogFragment implements
         intent.putExtra(CAddSignatureActivity.EXTRA_SHOW_NONE_TYPE, true);
         intent.putExtra(CAddSignatureActivity.EXTRA_TITLE, getString(R.string.tools_customize_the_signature_appearance));
         intent.putExtra(CAddSignatureActivity.EXTRA_SCREEN_ORIENTATION, ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
+        intent.putExtra(CAddSignatureActivity.EXTRA_HIDE_TYPEFACE, true);
         addSignatureLauncher.launch(intent);
     }
 
@@ -143,7 +136,7 @@ public class CPDFSelectDigitalSignatureDialog extends DialogFragment implements
         this.certDigitalSignListener = certDigitalSignListener;
     }
 
-    public interface COnCertDigitalSignListener{
+    public interface COnCertDigitalSignListener {
         void sign(String certFilePath, String certPassword, String signImagePath);
     }
 }

+ 26 - 5
ComPDFKit_Tools/src/main/res/layout-land/tools_properties_signature_style_add_activity.xml

@@ -101,20 +101,30 @@
 
         <com.compdfkit.tools.common.views.pdfproperties.colorlist.ColorListView
             android:id="@+id/color_list_view"
-            android:layout_width="200dp"
+            android:layout_width="0dp"
             android:layout_height="wrap_content"
-            android:layout_marginStart="40dp"
+            android:layout_marginStart="20dp"
             app:tools_color_list="@array/tools_annot_signature_colors"
             app:layout_constraintBottom_toBottomOf="parent"
-            app:layout_constraintEnd_toStartOf="@id/cl_thickness"
+            app:layout_constraintEnd_toStartOf="@id/barrier"
             app:layout_constraintHorizontal_bias="1"
-            app:layout_constraintStart_toEndOf="@id/iv_add_pic_signature"
+           app:layout_constraintHorizontal_weight="1"
+            app:layout_constraintStart_toEndOf="@id/iv_none"
             app:layout_constraintTop_toTopOf="parent"
             app:tools_show_title="false" />
 
+        <androidx.constraintlayout.widget.Barrier
+            android:id="@+id/barrier"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            app:barrierDirection="start"
+            app:constraint_referenced_ids="cl_thickness,font_view"
+            />
+
         <androidx.constraintlayout.widget.ConstraintLayout
             android:id="@+id/cl_thickness"
             android:layout_width="wrap_content"
+            android:visibility="gone"
             android:layout_height="wrap_content"
             app:layout_constraintBottom_toBottomOf="parent"
             app:layout_constraintEnd_toEndOf="parent"
@@ -145,6 +155,16 @@
 
         </androidx.constraintlayout.widget.ConstraintLayout>
 
+        <com.compdfkit.tools.common.views.pdfproperties.font.CPDFFontView
+            android:layout_width="380dp"
+            android:layout_height="match_parent"
+            app:layout_constraintTop_toTopOf="parent"
+            app:layout_constraintBottom_toBottomOf="parent"
+            app:layout_constraintEnd_toEndOf="parent"
+            android:visibility="gone"
+            tools:visibility="visible"
+            android:id="@+id/font_view"
+            />
 
     </androidx.constraintlayout.widget.ConstraintLayout>
 
@@ -171,7 +191,8 @@
             android:hint="@string/tools_enter_your_signature"
             android:textColor="@android:color/black"
             android:textColorHint="@color/tools_text_color_hint"
-            android:textSize="20sp"
+            android:textSize="35sp"
+            tools:visibility="visible"
             android:visibility="gone" />
 
         <androidx.cardview.widget.CardView

+ 72 - 0
ComPDFKit_Tools/src/main/res/layout/tools_cpdf_font_view.xml

@@ -0,0 +1,72 @@
+<?xml version="1.0" encoding="utf-8"?>
+<androidx.constraintlayout.widget.ConstraintLayout
+    android:layout_width="match_parent"
+    android:layout_height="wrap_content"
+    android:paddingVertical="4dp"
+    xmlns:app="http://schemas.android.com/apk/res-auto"
+    xmlns:android="http://schemas.android.com/apk/res/android"
+  >
+
+
+    <androidx.appcompat.widget.AppCompatTextView
+        android:id="@+id/tv_font_type"
+        style="@style/tools_style_fragment_sub_title_style"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:text="@string/tools_annot_font"
+        app:layout_constraintStart_toStartOf="parent"
+        app:layout_constraintTop_toTopOf="parent" />
+
+    <Spinner
+        android:id="@+id/spinner_font"
+        android:layout_width="0dp"
+        android:layout_height="35dp"
+        android:layout_marginStart="16dp"
+        android:spinnerMode="dropdown"
+        android:popupElevation="4dp"
+        android:padding="0dp"
+        android:dropDownSelector="@color/tools_color_primary"
+        android:popupBackground="@drawable/tools_common_window_bg"
+        app:layout_constraintBottom_toBottomOf="@id/tv_font_type"
+        app:layout_constraintEnd_toStartOf="@id/spinner_font_style"
+        app:layout_constraintStart_toEndOf="@id/tv_font_type"
+        app:layout_constraintTop_toTopOf="@id/tv_font_type" />
+
+    <View
+        android:id="@+id/font_line"
+        style="@style/tools_style_fragment_line"
+        android:layout_width="0dp"
+        android:layout_marginHorizontal="8dp"
+        app:layout_constraintStart_toStartOf="@id/spinner_font"
+        app:layout_constraintEnd_toEndOf="@id/spinner_font"
+        app:layout_constraintTop_toBottomOf="@id/spinner_font" />
+
+    <Spinner
+        android:id="@+id/spinner_font_style"
+        android:layout_width="140dp"
+        android:layout_height="35dp"
+        app:layout_constraintHorizontal_bias="1"
+        android:paddingHorizontal="4dp"
+        android:layout_marginStart="8dp"
+        android:layout_marginEnd="16dp"
+        android:spinnerMode="dropdown"
+        android:popupElevation="4dp"
+        android:dropDownSelector="@color/tools_color_primary"
+        android:popupBackground="@drawable/tools_common_window_bg"
+        app:layout_constraintBottom_toBottomOf="@id/tv_font_type"
+        app:layout_constraintStart_toEndOf="@id/spinner_font"
+        app:layout_constraintEnd_toEndOf="parent"
+        app:layout_constraintTop_toTopOf="@id/tv_font_type" />
+
+
+    <View
+        android:id="@+id/font_line_2"
+        style="@style/tools_style_fragment_line"
+        android:layout_width="0dp"
+        android:layout_marginHorizontal="8dp"
+        app:layout_constraintStart_toStartOf="@id/spinner_font_style"
+        app:layout_constraintEnd_toEndOf="@id/spinner_font_style"
+        app:layout_constraintTop_toBottomOf="@id/spinner_font_style" />
+
+
+</androidx.constraintlayout.widget.ConstraintLayout>

+ 7 - 60
ComPDFKit_Tools/src/main/res/layout/tools_cpdf_security_watermark_text_style_fragment.xml

@@ -29,77 +29,24 @@
             app:layout_constraintTop_toBottomOf="@id/border_color_list_view"
             app:tools_slider_bar_value_show_type="percentage" />
 
-
-        <androidx.appcompat.widget.AppCompatTextView
-            android:id="@+id/tv_font_type"
-            style="@style/tools_style_fragment_sub_title_style"
-            android:layout_width="wrap_content"
+        <com.compdfkit.tools.common.views.pdfproperties.font.CPDFFontView
+            android:layout_width="match_parent"
             android:layout_height="wrap_content"
-            android:layout_marginTop="16dp"
-            android:text="@string/tools_annot_font"
+            app:layout_constraintTop_toBottomOf="@id/slider_bar"
             app:layout_constraintStart_toStartOf="parent"
-            app:layout_constraintTop_toBottomOf="@id/slider_bar" />
-
-        <androidx.appcompat.widget.AppCompatSpinner
-            android:id="@+id/spinner_font"
-            android:layout_width="0dp"
-            android:layout_height="35dp"
-            android:layout_marginStart="20dp"
-            android:layout_marginEnd="16dp"
-            android:dropDownSelector="@color/tools_color_primary"
-            android:popupBackground="@drawable/tools_common_window_bg"
-            app:layout_constraintBottom_toBottomOf="@id/tv_font_type"
-            app:layout_constraintEnd_toStartOf="@id/iv_font_bold"
-            app:layout_constraintStart_toEndOf="@id/tv_font_type"
-            app:layout_constraintTop_toTopOf="@id/tv_font_type" />
-
-        <View
-            android:id="@+id/font_line"
-            style="@style/tools_style_fragment_line"
-            android:layout_width="0dp"
-            android:layout_marginHorizontal="12dp"
-            app:layout_constraintEnd_toEndOf="@id/spinner_font"
-            app:layout_constraintStart_toStartOf="@id/spinner_font"
-            app:layout_constraintTop_toBottomOf="@id/spinner_font" />
-
-
-        <androidx.appcompat.widget.AppCompatImageView
-            android:id="@+id/iv_font_italic"
-            android:layout_width="40dp"
-            android:layout_height="32dp"
-            android:layout_marginEnd="16dp"
-            android:background="@drawable/tools_annotation_font_italic_bg"
-            android:gravity="center"
-            android:padding="5dp"
-            app:layout_constraintBottom_toBottomOf="@id/tv_font_type"
             app:layout_constraintEnd_toEndOf="parent"
-            app:layout_constraintTop_toTopOf="@id/tv_font_type"
-            app:srcCompat="@drawable/tools_ic_font_italic"
-            app:tint="@color/tools_font_style_iv_color" />
-
-        <androidx.appcompat.widget.AppCompatImageView
-            android:id="@+id/iv_font_bold"
-            android:layout_width="40dp"
-            android:layout_height="32dp"
-            android:background="@drawable/tools_annotation_font_bold_bg"
-            android:gravity="center"
-            android:padding="5dp"
-            app:layout_constraintBottom_toBottomOf="@id/tv_font_type"
-            app:layout_constraintEnd_toStartOf="@id/iv_font_italic"
-            app:layout_constraintTop_toTopOf="@id/tv_font_type"
-            app:srcCompat="@drawable/tools_ic_font_bold"
-            app:tint="@color/tools_font_style_iv_color" />
-
+            android:id="@+id/font_view"
+            />
 
         <com.compdfkit.tools.common.utils.view.sliderbar.CSliderBar
             android:id="@+id/font_size_slider_bar"
             android:layout_width="match_parent"
             android:layout_height="wrap_content"
-            android:layout_marginTop="16dp"
+            android:layout_marginTop="4dp"
             android:max="100"
             android:progress="1"
             android:title="@string/tools_annot_font_size"
-            app:layout_constraintTop_toBottomOf="@id/iv_font_bold"
+            app:layout_constraintTop_toBottomOf="@id/font_view"
             app:tools_slider_bar_value_show_type="source"
             app:tools_value_unit="pt" />
 

+ 6 - 61
ComPDFKit_Tools/src/main/res/layout/tools_edit_text_property_fragment.xml

@@ -48,77 +48,22 @@
             app:tools_slider_bar_value_show_type="percentage" />
 
 
-        <androidx.appcompat.widget.AppCompatTextView
-            android:id="@+id/tv_font_type"
-            style="@style/tools_style_fragment_sub_title_style"
-            android:layout_width="wrap_content"
+        <com.compdfkit.tools.common.views.pdfproperties.font.CPDFFontView
+            android:layout_width="match_parent"
             android:layout_height="wrap_content"
-            android:layout_marginTop="16dp"
-            android:text="@string/tools_annot_font"
-            app:layout_constraintStart_toStartOf="parent"
-            app:layout_constraintTop_toBottomOf="@id/slider_bar" />
-
-        <androidx.appcompat.widget.AppCompatSpinner
-            android:id="@+id/spinner_font"
-            android:layout_width="0dp"
-            android:layout_height="35dp"
-            android:layout_marginStart="20dp"
-            android:layout_marginEnd="16dp"
-            android:dropDownSelector="@color/tools_color_primary"
-            android:popupBackground="@drawable/tools_common_window_bg"
-            app:layout_constraintBottom_toBottomOf="@id/tv_font_type"
-            app:layout_constraintEnd_toStartOf="@id/iv_font_bold"
-            app:layout_constraintStart_toEndOf="@id/tv_font_type"
-            app:layout_constraintTop_toTopOf="@id/tv_font_type" />
+            android:id="@+id/font_view"
+            app:layout_constraintTop_toBottomOf="@id/slider_bar"
 
-        <View
-            android:id="@+id/font_line"
-            style="@style/tools_style_fragment_line"
-            android:layout_width="0dp"
-            android:layout_marginHorizontal="12dp"
-            app:layout_constraintStart_toStartOf="@id/spinner_font"
-            app:layout_constraintEnd_toEndOf="@id/spinner_font"
-            app:layout_constraintTop_toBottomOf="@id/spinner_font"
             />
-
-
-
-        <androidx.appcompat.widget.AppCompatImageView
-            android:id="@+id/iv_font_italic"
-            android:layout_width="40dp"
-            android:layout_height="32dp"
-            android:layout_marginEnd="16dp"
-            android:background="@drawable/tools_annotation_font_italic_bg"
-            android:gravity="center"
-            android:padding="5dp"
-            app:layout_constraintBottom_toBottomOf="@id/tv_font_type"
-            app:layout_constraintEnd_toEndOf="parent"
-            app:layout_constraintTop_toTopOf="@id/tv_font_type"
-            app:srcCompat="@drawable/tools_ic_font_italic"
-            app:tint="@color/tools_font_style_iv_color" />
-
-        <androidx.appcompat.widget.AppCompatImageView
-            android:id="@+id/iv_font_bold"
-            android:layout_width="40dp"
-            android:layout_height="32dp"
-            android:background="@drawable/tools_annotation_font_bold_bg"
-            android:gravity="center"
-            android:padding="5dp"
-            app:layout_constraintBottom_toBottomOf="@id/tv_font_type"
-            app:layout_constraintEnd_toStartOf="@id/iv_font_italic"
-            app:layout_constraintTop_toTopOf="@id/tv_font_type"
-            app:srcCompat="@drawable/tools_ic_font_bold"
-            app:tint="@color/tools_font_style_iv_color" />
-
         <androidx.appcompat.widget.AppCompatTextView
             android:id="@+id/tv_align_type"
             style="@style/tools_style_fragment_sub_title_style"
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
-            android:layout_marginTop="28dp"
+            android:layout_marginTop="16dp"
             android:text="@string/tools_annot_align_type"
             app:layout_constraintStart_toStartOf="parent"
-            app:layout_constraintTop_toBottomOf="@id/tv_font_type" />
+            app:layout_constraintTop_toBottomOf="@id/font_view" />
 
         <LinearLayout
             android:id="@+id/ll_alignment_type"

+ 20 - 72
ComPDFKit_Tools/src/main/res/layout/tools_properties_free_text_style_fragment.xml

@@ -2,7 +2,8 @@
 <androidx.core.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:app="http://schemas.android.com/apk/res-auto"
     android:layout_width="match_parent"
-    android:layout_height="wrap_content">
+    android:layout_height="wrap_content"
+    xmlns:tools="http://schemas.android.com/tools">
 
     <androidx.constraintlayout.widget.ConstraintLayout
         android:id="@+id/cl_rootView"
@@ -33,10 +34,10 @@
             android:id="@+id/border_color_list_view"
             android:layout_width="match_parent"
             android:layout_height="wrap_content"
+            android:title="@string/tools_text_color"
             app:layout_constraintEnd_toEndOf="parent"
             app:layout_constraintStart_toStartOf="parent"
-            app:layout_constraintTop_toBottomOf="@id/line"
-            android:title="@string/tools_text_color" />
+            app:layout_constraintTop_toBottomOf="@id/line" />
 
         <com.compdfkit.tools.common.utils.view.sliderbar.CSliderBar
             android:id="@+id/slider_bar"
@@ -48,69 +49,16 @@
             app:tools_slider_bar_value_show_type="percentage" />
 
 
-        <androidx.appcompat.widget.AppCompatTextView
-            android:id="@+id/tv_font_type"
-            style="@style/tools_style_fragment_sub_title_style"
-            android:layout_width="wrap_content"
+
+        <com.compdfkit.tools.common.views.pdfproperties.font.CPDFFontView
+            android:layout_width="match_parent"
             android:layout_height="wrap_content"
-            android:layout_marginTop="16dp"
-            android:text="@string/tools_annot_font"
+            android:id="@+id/font_view"
+            app:layout_constraintTop_toBottomOf="@id/slider_bar"
             app:layout_constraintStart_toStartOf="parent"
-            app:layout_constraintTop_toBottomOf="@id/slider_bar" />
-
-        <Spinner
-            android:id="@+id/spinner_font"
-            android:layout_width="0dp"
-            android:layout_height="35dp"
-            android:layout_marginStart="20dp"
-            android:layout_marginEnd="16dp"
-            android:spinnerMode="dropdown"
-            android:popupElevation="4dp"
-            android:dropDownSelector="@color/tools_color_primary"
-            android:popupBackground="@drawable/tools_common_window_bg"
-            app:layout_constraintBottom_toBottomOf="@id/tv_font_type"
-            app:layout_constraintEnd_toStartOf="@id/iv_font_bold"
-            app:layout_constraintStart_toEndOf="@id/tv_font_type"
-            app:layout_constraintTop_toTopOf="@id/tv_font_type" />
-
-        <View
-            android:id="@+id/font_line"
-            style="@style/tools_style_fragment_line"
-            android:layout_width="0dp"
-            android:layout_marginHorizontal="12dp"
-            app:layout_constraintStart_toStartOf="@id/spinner_font"
-            app:layout_constraintEnd_toEndOf="@id/spinner_font"
-            app:layout_constraintTop_toBottomOf="@id/spinner_font"
-            />
-
-
-
-        <androidx.appcompat.widget.AppCompatImageView
-            android:id="@+id/iv_font_italic"
-            android:layout_width="40dp"
-            android:layout_height="32dp"
-            android:layout_marginEnd="16dp"
-            android:background="@drawable/tools_annotation_font_italic_bg"
-            android:gravity="center"
-            android:padding="5dp"
-            app:layout_constraintBottom_toBottomOf="@id/tv_font_type"
             app:layout_constraintEnd_toEndOf="parent"
-            app:layout_constraintTop_toTopOf="@id/tv_font_type"
-            app:srcCompat="@drawable/tools_ic_font_italic"
-            app:tint="@color/tools_font_style_iv_color" />
-
-        <androidx.appcompat.widget.AppCompatImageView
-            android:id="@+id/iv_font_bold"
-            android:layout_width="40dp"
-            android:layout_height="32dp"
-            android:background="@drawable/tools_annotation_font_bold_bg"
-            android:gravity="center"
-            android:padding="5dp"
-            app:layout_constraintBottom_toBottomOf="@id/tv_font_type"
-            app:layout_constraintEnd_toStartOf="@id/iv_font_italic"
-            app:layout_constraintTop_toTopOf="@id/tv_font_type"
-            app:srcCompat="@drawable/tools_ic_font_bold"
-            app:tint="@color/tools_font_style_iv_color" />
+            tools:layout_height="30dp"
+            />
 
         <androidx.appcompat.widget.AppCompatTextView
             android:id="@+id/tv_align_type"
@@ -120,7 +68,7 @@
             android:layout_marginTop="28dp"
             android:text="@string/tools_annot_align_type"
             app:layout_constraintStart_toStartOf="parent"
-            app:layout_constraintTop_toBottomOf="@id/tv_font_type" />
+            app:layout_constraintTop_toBottomOf="@id/font_view" />
 
         <LinearLayout
             android:id="@+id/ll_alignment_type"
@@ -142,8 +90,8 @@
                 android:button="@null"
                 android:padding="4dp"
                 android:textSize="0sp"
-                app:tint="@color/tools_font_style_iv_color"
-                app:srcCompat="@drawable/tools_font_alignment_left" />
+                app:srcCompat="@drawable/tools_font_alignment_left"
+                app:tint="@color/tools_font_style_iv_color" />
 
             <androidx.appcompat.widget.AppCompatImageView
                 android:id="@+id/iv_alignment_center"
@@ -151,9 +99,9 @@
                 android:layout_height="32dp"
                 android:background="@drawable/tools_annotation_font_alignment_bg"
                 android:padding="4dp"
-                app:tint="@color/tools_font_style_iv_color"
+                app:srcCompat="@drawable/tools_font_alignment_center"
 
-                app:srcCompat="@drawable/tools_font_alignment_center" />
+                app:tint="@color/tools_font_style_iv_color" />
 
             <androidx.appcompat.widget.AppCompatImageView
                 android:id="@+id/iv_alignment_right"
@@ -161,8 +109,8 @@
                 android:layout_height="32dp"
                 android:background="@drawable/tools_annotation_font_alignment_bg"
                 android:padding="4dp"
-                app:tint="@color/tools_font_style_iv_color"
-                app:srcCompat="@drawable/tools_font_alignment_right" />
+                app:srcCompat="@drawable/tools_font_alignment_right"
+                app:tint="@color/tools_font_style_iv_color" />
 
         </LinearLayout>
 
@@ -172,11 +120,11 @@
             android:layout_height="wrap_content"
             android:layout_marginTop="16dp"
             android:max="100"
-            app:tools_value_unit="pt"
             android:progress="1"
+            android:title="@string/tools_annot_font_size"
             app:layout_constraintTop_toBottomOf="@id/tv_align_type"
             app:tools_slider_bar_value_show_type="source"
-            android:title="@string/tools_annot_font_size" />
+            app:tools_value_unit="pt" />
 
 
     </androidx.constraintlayout.widget.ConstraintLayout>

+ 8 - 59
ComPDFKit_Tools/src/main/res/layout/tools_properties_list_box_style_fragment.xml

@@ -47,76 +47,25 @@
             app:layout_constraintTop_toBottomOf="@id/background_color_list_view"
             android:title="@string/tools_text_color" />
 
-
-        <androidx.appcompat.widget.AppCompatTextView
-            android:id="@+id/tv_font_type"
-            style="@style/tools_style_fragment_sub_title_style"
-            android:layout_width="wrap_content"
+        <com.compdfkit.tools.common.views.pdfproperties.font.CPDFFontView
+            android:layout_width="match_parent"
             android:layout_height="wrap_content"
-            android:layout_marginTop="24dp"
-            android:text="@string/tools_annot_font"
+            app:layout_constraintTop_toBottomOf="@id/text_color_list_view"
             app:layout_constraintStart_toStartOf="parent"
-            app:layout_constraintTop_toBottomOf="@id/text_color_list_view" />
-
-        <androidx.appcompat.widget.AppCompatSpinner
-            android:id="@+id/spinner_font"
-            android:layout_width="0dp"
-            android:layout_height="35dp"
-            android:layout_marginStart="20dp"
-            android:layout_marginEnd="16dp"
-            android:dropDownSelector="@color/tools_color_primary"
-            android:popupBackground="@drawable/tools_common_window_bg"
-            app:layout_constraintBottom_toBottomOf="@id/tv_font_type"
-            app:layout_constraintEnd_toStartOf="@id/iv_font_bold"
-            app:layout_constraintStart_toEndOf="@id/tv_font_type"
-            app:layout_constraintTop_toTopOf="@id/tv_font_type" />
-
-        <View
-            android:id="@+id/font_line"
-            style="@style/tools_style_fragment_line"
-            android:layout_width="0dp"
-            android:layout_marginHorizontal="12dp"
-            app:layout_constraintEnd_toEndOf="@id/spinner_font"
-            app:layout_constraintStart_toStartOf="@id/spinner_font"
-            app:layout_constraintTop_toBottomOf="@id/spinner_font" />
-
-
-        <androidx.appcompat.widget.AppCompatImageView
-            android:id="@+id/iv_font_italic"
-            android:layout_width="40dp"
-            android:layout_height="32dp"
-            android:layout_marginEnd="16dp"
-            android:background="@drawable/tools_annotation_font_italic_bg"
-            android:gravity="center"
-            android:padding="5dp"
-            app:layout_constraintBottom_toBottomOf="@id/tv_font_type"
             app:layout_constraintEnd_toEndOf="parent"
-            app:layout_constraintTop_toTopOf="@id/tv_font_type"
-            app:srcCompat="@drawable/tools_ic_font_italic"
-            app:tint="@color/tools_font_style_iv_color" />
-
-        <androidx.appcompat.widget.AppCompatImageView
-            android:id="@+id/iv_font_bold"
-            android:layout_width="40dp"
-            android:layout_height="32dp"
-            android:background="@drawable/tools_annotation_font_bold_bg"
-            android:gravity="center"
-            android:padding="5dp"
-            app:layout_constraintBottom_toBottomOf="@id/tv_font_type"
-            app:layout_constraintEnd_toStartOf="@id/iv_font_italic"
-            app:layout_constraintTop_toTopOf="@id/tv_font_type"
-            app:srcCompat="@drawable/tools_ic_font_bold"
-            app:tint="@color/tools_font_style_iv_color" />
+            android:id="@+id/font_view"
+            android:layout_marginTop="4dp"
+            />
 
         <com.compdfkit.tools.common.utils.view.sliderbar.CSliderBar
             android:id="@+id/font_size_slider_bar"
             android:layout_width="match_parent"
             android:layout_height="wrap_content"
-            android:layout_marginTop="16dp"
+            android:layout_marginTop="8dp"
             android:max="100"
             app:tools_value_unit="pt"
             android:progress="1"
-            app:layout_constraintTop_toBottomOf="@id/iv_font_bold"
+            app:layout_constraintTop_toBottomOf="@id/font_view"
             app:tools_slider_bar_value_show_type="source"
             android:title="@string/tools_annot_font_size" />
 

+ 8 - 59
ComPDFKit_Tools/src/main/res/layout/tools_properties_push_button_style_fragment.xml

@@ -79,76 +79,25 @@
             app:layout_constraintTop_toBottomOf="@id/background_color_list_view"
             android:title="@string/tools_text_color" />
 
-
-        <androidx.appcompat.widget.AppCompatTextView
-            android:id="@+id/tv_font_type"
-            style="@style/tools_style_fragment_sub_title_style"
-            android:layout_width="wrap_content"
+        <com.compdfkit.tools.common.views.pdfproperties.font.CPDFFontView
+            android:layout_width="match_parent"
             android:layout_height="wrap_content"
-            android:layout_marginTop="24dp"
-            android:text="@string/tools_annot_font"
+            app:layout_constraintTop_toBottomOf="@id/text_color_list_view"
             app:layout_constraintStart_toStartOf="parent"
-            app:layout_constraintTop_toBottomOf="@id/text_color_list_view" />
-
-        <androidx.appcompat.widget.AppCompatSpinner
-            android:id="@+id/spinner_font"
-            android:layout_width="0dp"
-            android:layout_height="35dp"
-            android:layout_marginStart="20dp"
-            android:layout_marginEnd="16dp"
-            android:dropDownSelector="@color/tools_color_primary"
-            android:popupBackground="@drawable/tools_common_window_bg"
-            app:layout_constraintBottom_toBottomOf="@id/tv_font_type"
-            app:layout_constraintEnd_toStartOf="@id/iv_font_bold"
-            app:layout_constraintStart_toEndOf="@id/tv_font_type"
-            app:layout_constraintTop_toTopOf="@id/tv_font_type" />
-
-        <View
-            android:id="@+id/font_line"
-            style="@style/tools_style_fragment_line"
-            android:layout_width="0dp"
-            android:layout_marginHorizontal="12dp"
-            app:layout_constraintEnd_toEndOf="@id/spinner_font"
-            app:layout_constraintStart_toStartOf="@id/spinner_font"
-            app:layout_constraintTop_toBottomOf="@id/spinner_font" />
-
-
-        <androidx.appcompat.widget.AppCompatImageView
-            android:id="@+id/iv_font_italic"
-            android:layout_width="40dp"
-            android:layout_height="32dp"
-            android:layout_marginEnd="16dp"
-            android:background="@drawable/tools_annotation_font_italic_bg"
-            android:gravity="center"
-            android:padding="5dp"
-            app:layout_constraintBottom_toBottomOf="@id/tv_font_type"
             app:layout_constraintEnd_toEndOf="parent"
-            app:layout_constraintTop_toTopOf="@id/tv_font_type"
-            app:srcCompat="@drawable/tools_ic_font_italic"
-            app:tint="@color/tools_font_style_iv_color" />
-
-        <androidx.appcompat.widget.AppCompatImageView
-            android:id="@+id/iv_font_bold"
-            android:layout_width="40dp"
-            android:layout_height="32dp"
-            android:background="@drawable/tools_annotation_font_bold_bg"
-            android:gravity="center"
-            android:padding="5dp"
-            app:layout_constraintBottom_toBottomOf="@id/tv_font_type"
-            app:layout_constraintEnd_toStartOf="@id/iv_font_italic"
-            app:layout_constraintTop_toTopOf="@id/tv_font_type"
-            app:srcCompat="@drawable/tools_ic_font_bold"
-            app:tint="@color/tools_font_style_iv_color" />
+            android:id="@+id/font_view"
+            android:layout_marginTop="4dp"
+            />
 
         <com.compdfkit.tools.common.utils.view.sliderbar.CSliderBar
             android:id="@+id/font_size_slider_bar"
             android:layout_width="match_parent"
             android:layout_height="wrap_content"
-            android:layout_marginTop="16dp"
+            android:layout_marginTop="4dp"
             android:max="100"
             android:progress="1"
             app:tools_value_unit="pt"
-            app:layout_constraintTop_toBottomOf="@id/iv_font_bold"
+            app:layout_constraintTop_toBottomOf="@id/font_view"
             app:tools_slider_bar_value_show_type="source"
            android:title="@string/tools_annot_font_size" />
 

+ 21 - 3
ComPDFKit_Tools/src/main/res/layout/tools_properties_signature_style_add_activity.xml

@@ -149,12 +149,29 @@
 
     </androidx.constraintlayout.widget.ConstraintLayout>
 
+    <com.compdfkit.tools.common.views.pdfproperties.font.CPDFFontView
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        app:layout_constraintTop_toBottomOf="@id/cl_menu"
+        android:background="@color/tools_reader_setting_head_bg_color"
+        android:visibility="gone"
+        android:id="@+id/font_view"
+        />
+
+    <androidx.constraintlayout.widget.Barrier
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        app:barrierDirection="bottom"
+        app:constraint_referenced_ids="font_view,cl_thickness"
+        android:id="@+id/barrier"
+        />
+
     <androidx.constraintlayout.widget.ConstraintLayout
         android:id="@+id/cl_content_view"
         android:layout_width="match_parent"
         android:layout_height="0dp"
         app:layout_constraintBottom_toBottomOf="parent"
-        app:layout_constraintTop_toBottomOf="@id/cl_thickness">
+        app:layout_constraintTop_toBottomOf="@id/barrier">
 
 
         <com.compdfkit.tools.common.views.pdfproperties.writing.CPDFSignatureEditView
@@ -172,8 +189,9 @@
             android:hint="@string/tools_enter_your_signature"
             android:textColor="@android:color/black"
             android:textColorHint="@color/tools_text_color_hint"
-            android:textSize="20sp"
-            android:visibility="gone" />
+            android:textSize="35sp"
+            android:visibility="gone"
+            tools:visibility="visible"/>
 
         <androidx.cardview.widget.CardView
             android:id="@+id/card_import_image"

+ 8 - 59
ComPDFKit_Tools/src/main/res/layout/tools_properties_text_fields_style_fragment.xml

@@ -48,75 +48,24 @@
             app:layout_constraintTop_toBottomOf="@id/background_color_list_view" />
 
 
-        <androidx.appcompat.widget.AppCompatTextView
-            android:id="@+id/tv_font_type"
-            style="@style/tools_style_fragment_sub_title_style"
-            android:layout_width="wrap_content"
+        <com.compdfkit.tools.common.views.pdfproperties.font.CPDFFontView
+            android:layout_width="match_parent"
             android:layout_height="wrap_content"
-            android:layout_marginTop="24dp"
-            android:text="@string/tools_annot_font"
+            app:layout_constraintTop_toBottomOf="@id/text_color_list_view"
             app:layout_constraintStart_toStartOf="parent"
-            app:layout_constraintTop_toBottomOf="@id/text_color_list_view" />
-
-        <androidx.appcompat.widget.AppCompatSpinner
-            android:id="@+id/spinner_font"
-            android:layout_width="0dp"
-            android:layout_height="35dp"
-            android:layout_marginStart="20dp"
-            android:layout_marginEnd="16dp"
-            android:dropDownSelector="@color/tools_color_primary"
-            android:popupBackground="@drawable/tools_common_window_bg"
-            app:layout_constraintBottom_toBottomOf="@id/tv_font_type"
-            app:layout_constraintEnd_toStartOf="@id/iv_font_bold"
-            app:layout_constraintStart_toEndOf="@id/tv_font_type"
-            app:layout_constraintTop_toTopOf="@id/tv_font_type" />
-
-        <View
-            android:id="@+id/font_line"
-            style="@style/tools_style_fragment_line"
-            android:layout_width="0dp"
-            android:layout_marginHorizontal="12dp"
-            app:layout_constraintEnd_toEndOf="@id/spinner_font"
-            app:layout_constraintStart_toStartOf="@id/spinner_font"
-            app:layout_constraintTop_toBottomOf="@id/spinner_font" />
-
-
-        <androidx.appcompat.widget.AppCompatImageView
-            android:id="@+id/iv_font_italic"
-            android:layout_width="40dp"
-            android:layout_height="32dp"
-            android:layout_marginEnd="16dp"
-            android:background="@drawable/tools_annotation_font_italic_bg"
-            android:gravity="center"
-            android:padding="5dp"
-            app:layout_constraintBottom_toBottomOf="@id/tv_font_type"
             app:layout_constraintEnd_toEndOf="parent"
-            app:layout_constraintTop_toTopOf="@id/tv_font_type"
-            app:srcCompat="@drawable/tools_ic_font_italic"
-            app:tint="@color/tools_font_style_iv_color" />
-
-        <androidx.appcompat.widget.AppCompatImageView
-            android:id="@+id/iv_font_bold"
-            android:layout_width="40dp"
-            android:layout_height="32dp"
-            android:background="@drawable/tools_annotation_font_bold_bg"
-            android:gravity="center"
-            android:padding="5dp"
-            app:layout_constraintBottom_toBottomOf="@id/tv_font_type"
-            app:layout_constraintEnd_toStartOf="@id/iv_font_italic"
-            app:layout_constraintTop_toTopOf="@id/tv_font_type"
-            app:srcCompat="@drawable/tools_ic_font_bold"
-            app:tint="@color/tools_font_style_iv_color" />
-
+            android:id="@+id/font_view"
+            android:layout_marginTop="4dp"
+            />
         <androidx.appcompat.widget.AppCompatTextView
             android:id="@+id/tv_align_type"
             style="@style/tools_style_fragment_sub_title_style"
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
-            android:layout_marginTop="28dp"
+            android:layout_marginTop="16dp"
             android:text="@string/tools_annot_align_type"
             app:layout_constraintStart_toStartOf="parent"
-            app:layout_constraintTop_toBottomOf="@id/tv_font_type" />
+            app:layout_constraintTop_toBottomOf="@id/font_view" />
 
         <LinearLayout
             android:id="@+id/ll_alignment_type"

+ 5 - 1
ComPDFKit_Tools/src/main/res/layout/tools_spinner_list_item.xml

@@ -1,5 +1,6 @@
 <?xml version="1.0" encoding="utf-8"?>
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:app="http://schemas.android.com/apk/res-auto"
     android:id="@+id/ll_root"
     android:layout_width="match_parent"
     android:layout_height="wrap_content"
@@ -14,7 +15,10 @@
         android:layout_marginEnd="16dp"
         android:text="@string/tools_view_setting"
         android:textColor="@color/tools_subtitle_1_color"
-        android:textSize="14sp" />
+        app:autoSizeTextType="uniform"
+        app:autoSizeMaxTextSize="14sp"
+        app:autoSizeMinTextSize="9sp"
+        />
 
 </LinearLayout>
 

+ 6 - 0
ComPDFKit_Tools/src/main/res/values-zh-rCN/tools_strings.xml

@@ -484,4 +484,10 @@
     <string name="tools_flattened_suffix">_扁平化文档.pdf</string>
 
 
+    <string name="tools_font_style_normal">常规</string>
+    <string name="tools_font_style_bold">加粗</string>
+    <string name="tools_font_style_italic">斜体</string>
+    <string name="tools_font_style_bold_italic">加粗&amp;斜体</string>
+
+
 </resources>

+ 7 - 0
ComPDFKit_Tools/src/main/res/values/tools_strings.xml

@@ -488,4 +488,11 @@
     <string name="tools_effective_immediately_after_setting">Effective immediately after setting</string>
     <string name="tools_loading">Loading…</string>
     <string name="tools_flattened_suffix">_Flattened.pdf</string>
+
+<!--    v2.0.0 -->
+    <string name="tools_font_style_normal">Normal</string>
+    <string name="tools_font_style_bold">Bold</string>
+    <string name="tools_font_style_italic">Italic</string>
+    <string name="tools_font_style_bold_italic">Bold&amp;Italic</string>
+
 </resources>