Skip to content

Commit bdea114

Browse files
committed
Merge branch 'fix'
2 parents 1fa6b3c + 27ab06f commit bdea114

File tree

3 files changed

+65
-4
lines changed

3 files changed

+65
-4
lines changed

docs/src/01-example.md

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# [Example](@id init_example)
2+
3+
## Create a Figure
4+
5+
by default the Figure is created to be A3 format 420x297 px
6+
7+
```@example
8+
using ThesisArt
9+
using CairoMakie
10+
11+
nothing #hide
12+
```
13+
14+
```@example
15+
16+
backgroundcolor = "#333"
17+
f,ax_main = ThesisArt.newfigure(;backgroundcolor)
18+
nothing #hide
19+
```
20+
21+
## Read the text
22+
23+
I cant share the pdf right now, so we'll use a dummy text
24+
25+
```@example
26+
# t_text = import_pdf("file.pdf",pages=[2 4:24...]);
27+
t_text = text = "Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet."
28+
nothing #hide
29+
```
30+
31+
## Create the title
32+
33+
```@example
34+
(h_title,h_nameyear),ax_title = add_title!(f,"My Awesome Thesis \n Title","Benedikt Ehinger","August 2024")
35+
nothing #hide
36+
```
37+
38+
## Create a curve, path etc
39+
40+
For this example we'll use a simple BezierPath / Svg String
41+
42+
```@example
43+
44+
path_bat = CairoMakie.BezierPath("M96.84 141.998c-4.947-23.457-20.359-32.211-25.862-13.887-11.822-22.963-37.961-16.135-22.041 6.289-3.005-1.295-5.872-2.682-8.538-4.191-8.646-5.318-15.259-11.314-19.774-17.586-3.237-5.07-4.994-10.541-4.994-16.229 0-19.774 21.115-36.758 50.861-43.694.446-.078.909-.154 1.372-.231-22.657 30.039 9.386 50.985 15.258 24.645l2.528-24.367 5.086 6.52H103.205l5.07-6.52 2.543 24.367c5.842 26.278 37.746 5.502 15.414-24.429 29.777 6.951 50.891 23.936 50.891 43.709 0 15.136-12.406 28.651-31.609 37.267 14.842-21.822-10.867-28.266-22.549-5.549-5.502-18.325-21.147-9.341-26.125 13.886")
45+
nothing #hide
46+
```
47+
48+
## Plot the text on path
49+
50+
```@example
51+
textpath = ThesisArt.TextOnPath(t_text,path_bat)
52+
text!(ax_main,0.0,0,text=textpath,fontcolor = :white,fontsize=10)
53+
```
54+
55+
## The final thesis art
56+
57+
```@example
58+
f
59+
```

src/fontOnCurve.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
"""
22
Code written mostly by Julius Krumbiegel with some modifications by Benedikt Ehinger
3+
4+
# Important: Don't provide a closed path, it can lead to infinite loops
35
"""
46
struct TextOnPath
57
text::String

src/utils.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ end
55

66
function newfigure(; size = (420, 594), size_factor = 1, kwargs...)
77
f = Figure(; size = size .* size_factor, kwargs...)
8-
ax = f[1, 1] = Axis(f)
8+
ax = f[1, 1] = Axis(f, backgroundcolor = Makie.GrayA(0, 0))
99
hidespines!(ax)
1010
hidedecorations!(ax)
1111
return f, ax
@@ -27,22 +27,22 @@ function add_title!(f, title, name, year)
2727
ax,
2828
0.85,
2929
0.05,
30-
text = [name * "\n" * string(year)],
30+
text = [string(name) * "\n" * string(year)],
3131
position = [0, 0],
3232
justification = :right,
3333
color = "#888",
3434
fontsize = 7,
3535
)
3636
xlims!(ax, (0, 1.0))
3737
ylims!(ax, (0, 1.0))
38-
return (t1, t2, ax)
38+
return (t1, t2), ax
3939
end
4040

4141
function add_spacer!(f, row, col, aspect; debug = false)
4242
if debug
4343
a = f[row, col] = Axis(f, backgroundcolor = "red")
4444
else
45-
a = f[row, col] = Axis(f)
45+
a = f[row, col] = Axis(f, backgroundcolor = Makie.GrayA(0, 0))
4646
end
4747
if length(row) == 1
4848
# define a row

0 commit comments

Comments
 (0)