Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
Y
yifu-mvp
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
fangxinjiang
yifu-mvp
Commits
72db687a
Commit
72db687a
authored
Sep 11, 2025
by
fangxinjiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
自定义字体-fxj
parent
3f9308f6
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
4 deletions
+4
-4
RandomFontStyleUtil.java
...u/cloud/plus/v1/yifu/social/util/RandomFontStyleUtil.java
+4
-4
No files found.
yifu-social/yifu-social-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/social/util/RandomFontStyleUtil.java
View file @
72db687a
...
@@ -16,13 +16,14 @@ import java.util.Random;
...
@@ -16,13 +16,14 @@ import java.util.Random;
public
class
RandomFontStyleUtil
{
public
class
RandomFontStyleUtil
{
// 常见中文字体列表
// 常见中文字体列表
private
static
final
String
[]
FONT_NAMES
=
{
private
static
final
String
[]
FONT_NAMES
=
{
"宋体"
,
"楷体"
,
"仿宋"
,
"黑体"
,
"幼圆"
,
"微软雅黑"
,
"华文行楷"
,
"方正舒体"
,
"宋体"
,
"楷体"
,
"仿宋"
,
"隶书"
,
"华文隶书"
,
"华文行楷"
,
"方正舒体"
"隶书"
,
"华文隶书"
,
"幼圆"
,
"Allison"
,
"Bradley Hand"
};
};
// 字体大小范围
// 字体大小范围
private
static
final
int
MIN_FONT_SIZE
=
11
;
private
static
final
int
MIN_FONT_SIZE
=
11
;
private
static
final
int
MAX_FONT_SIZE
=
1
3
;
private
static
final
int
MAX_FONT_SIZE
=
1
6
;
/**
/**
* 为单元格设置随机字体样式
* 为单元格设置随机字体样式
...
@@ -37,7 +38,6 @@ public class RandomFontStyleUtil {
...
@@ -37,7 +38,6 @@ public class RandomFontStyleUtil {
// 设置随机字体
// 设置随机字体
Random
random
=
new
Random
();
Random
random
=
new
Random
();
font
.
setFontName
(
FONT_NAMES
[
random
.
nextInt
(
FONT_NAMES
.
length
)]);
font
.
setFontName
(
FONT_NAMES
[
random
.
nextInt
(
FONT_NAMES
.
length
)]);
log
.
error
(
"随机字体:"
+
font
.
getFontName
());
// 设置随机字体大小
// 设置随机字体大小
font
.
setFontHeightInPoints
((
short
)
(
MIN_FONT_SIZE
+
random
.
nextInt
(
MAX_FONT_SIZE
-
MIN_FONT_SIZE
+
1
)));
font
.
setFontHeightInPoints
((
short
)
(
MIN_FONT_SIZE
+
random
.
nextInt
(
MAX_FONT_SIZE
-
MIN_FONT_SIZE
+
1
)));
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment