Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
I
ImgGen
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
MyCard
ImgGen
Commits
aadd2dc0
Commit
aadd2dc0
authored
Apr 28, 2020
by
mercury233
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
load font from file
parent
f137400f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
36 additions
and
4 deletions
+36
-4
DataManager.cs
DataManager.cs
+8
-4
Program.cs
Program.cs
+28
-0
No files found.
DataManager.cs
View file @
aadd2dc0
...
@@ -39,10 +39,9 @@ namespace ImgGen
...
@@ -39,10 +39,9 @@ namespace ImgGen
private
static
StringFormat
rightAlignFormat
;
private
static
StringFormat
rightAlignFormat
;
private
static
string
xyzString
=
"超量"
;
private
static
string
xyzString
=
"超量"
;
private
static
string
fontName
=
"文泉驿微米黑"
;
private
static
string
fontLiShuName
=
"方正隶变_GBK"
;
private
static
string
numfontName
=
"MatrixBoldSmallCaps"
;
private
static
string
spfontName
=
"黑体"
;
private
static
string
spfontName
=
"黑体"
;
private
static
FontFamily
fontName
;
private
static
FontFamily
numfontName
;
private
static
List
<
int
>
zeroStarCards
=
new
List
<
int
>();
private
static
List
<
int
>
zeroStarCards
=
new
List
<
int
>();
...
@@ -63,11 +62,16 @@ namespace ImgGen
...
@@ -63,11 +62,16 @@ namespace ImgGen
}
}
}
}
numfontName
=
Program
.
GetFontFamily
(
"MatrixBoldSmallCaps"
);
string
_style
=
System
.
Configuration
.
ConfigurationManager
.
AppSettings
[
"Style"
];
string
_style
=
System
.
Configuration
.
ConfigurationManager
.
AppSettings
[
"Style"
];
if
(
_style
==
"隶书"
)
if
(
_style
==
"隶书"
)
{
{
LiShu
=
true
;
LiShu
=
true
;
fontName
=
fontLiShuName
;
fontName
=
Program
.
GetFontFamily
(
"方正隶变_GBK"
);
}
else
{
fontName
=
Program
.
GetFontFamily
(
"文泉驿微米黑"
);
}
}
string
_namestyle
=
System
.
Configuration
.
ConfigurationManager
.
AppSettings
[
"NameStyle"
];
string
_namestyle
=
System
.
Configuration
.
ConfigurationManager
.
AppSettings
[
"NameStyle"
];
...
...
Program.cs
View file @
aadd2dc0
...
@@ -4,6 +4,7 @@ namespace ImgGen
...
@@ -4,6 +4,7 @@ namespace ImgGen
using
System.Collections.Generic
;
using
System.Collections.Generic
;
using
System.Drawing
;
using
System.Drawing
;
using
System.Drawing.Imaging
;
using
System.Drawing.Imaging
;
using
System.Drawing.Text
;
using
System.IO
;
using
System.IO
;
internal
class
Program
internal
class
Program
...
@@ -21,8 +22,35 @@ namespace ImgGen
...
@@ -21,8 +22,35 @@ namespace ImgGen
return
null
;
return
null
;
}
}
private
static
PrivateFontCollection
fontCollection
;
public
static
FontFamily
GetFontFamily
(
string
fontName
)
{
try
{
return
new
FontFamily
(
fontName
,
fontCollection
);
}
catch
{
try
{
return
new
FontFamily
(
fontName
);
}
catch
{
Console
.
WriteLine
(
$"Font
{
fontName
}
not found!"
);
return
new
FontFamily
(
"Arial"
);
}
}
}
private
static
void
Main
(
string
[]
args
)
private
static
void
Main
(
string
[]
args
)
{
{
fontCollection
=
new
PrivateFontCollection
();
foreach
(
string
font
in
Directory
.
GetFiles
(
"./fonts"
))
{
fontCollection
.
AddFontFile
(
font
);
}
if
(
args
.
Length
>
0
)
if
(
args
.
Length
>
0
)
{
{
DataManager
.
InitialDatas
(
args
[
0
]);
DataManager
.
InitialDatas
(
args
[
0
]);
...
...
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