JuliaGraphics / FreeTypeAbstraction.jl

A Julian abstraction layer over FreeType.jl
Other
25 stars 20 forks source link

Fix typos #40

Closed ericphanson closed 4 years ago

ericphanson commented 4 years ago

This PR is also an issue-- I hope that's alright.

I'm trying to figure out how to use boundingbox; even with these fixes, e.g.

face= FreeTypeAbstraction.findfont("Times")
FreeTypeAbstraction.boundingbox("abc", face, 1f0)

fails with an error

ERROR: MethodError: no method matching iterate(::FontExtent{Float32})
Closest candidates are:
  iterate(::Core.SimpleVector) at essentials.jl:603
  iterate(::Core.SimpleVector, ::Any) at essentials.jl:603
  iterate(::ExponentialBackOff) at error.jl:253
  ...
Stacktrace:
 [1] _foldl_impl(::Base.BottomRF{typeof(min)}, ::Base._InitialValue, ::FontExtent{Float32}) at ./reduce.jl:53
 [2] foldl_impl(::Base.BottomRF{typeof(min)}, ::NamedTuple{(),Tuple{}}, ::FontExtent{Float32}) at ./reduce.jl:45
 [3] mapfoldl_impl(::typeof(identity), ::typeof(min), ::NamedTuple{(),Tuple{}}, ::FontExtent{Float32}) at ./reduce.jl:41
 [4] mapfoldl(::Function, ::Function, ::FontExtent{Float32}; kw::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}) at ./reduce.jl:157
 [5] mapfoldl(::Function, ::Function, ::FontExtent{Float32}) at ./reduce.jl:157
 [6] mapreduce(::Function, ::Function, ::FontExtent{Float32}; kw::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}) at ./reduce.jl:283
 [7] mapreduce(::Function, ::Function, ::FontExtent{Float32}) at ./reduce.jl:283
 [8] minimum(::FontExtent{Float32}) at ./reduce.jl:660
 [9] iterate_extents(::FreeTypeAbstraction.var"#24#25"{Array{GeometryTypes.HyperRectangle{2,Float32},1}}, ::String, ::FTFont, ::Float32) at /Users/eh540/.julia/dev/FreeTypeAbstraction/src/layout.jl:38
 [10] glyph_rects at /Users/eh540/.julia/dev/FreeTypeAbstraction/src/layout.jl:49 [inlined]
 [11] boundingbox(::String, ::FTFont, ::Float32) at /Users/eh540/.julia/dev/FreeTypeAbstraction/src/layout.jl:56
 [12] top-level scope at REPL[18]:1

Would appreciate any help :)

I'm trying to write a function (str::String, face::FTFont) -> img::Matrix{UInt8} where I don't have to know the size ahead of time like with renderstring!, and I thought boundingbox might help.

SimonDanisch commented 4 years ago

Wow :D Not sure what happened, that I actually ended up committing this... I fixed the issues in: https://github.com/JuliaGraphics/FreeTypeAbstraction.jl/pull/40 Thanks for starting this!

ericphanson commented 4 years ago

I was surprised too, haha. Thanks for the quick fix and release!