Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

jk/tex gyre heros #1897

Merged
merged 7 commits into from
May 16, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

## master

- Changed the default font from `Dejavu Sans` to `TeX Gyre Heros Makie` which is the same as `TeX Gyre Heros` with slightly decreased descenders and ascenders. Decreasing those metrics reduced unnecessary whitespace and alignment issues. Four fonts in total were added, the styles Regular, Bold, Italic and Bold Italic. Also changed `Axis`, `Axis3` and `Legend` attributes `titlefont` to `TeX Gyre Heros Makie Bold` in order to separate it better from axis labels in multifacet arrangements [#1897](https://github.com/JuliaPlots/Makie.jl/pull/1897).

## v0.17.1
- Added word wrapping. In `Label`, `word_wrap = true` causes it to use the suggested width and wrap text to fit. In `text`, `word_wrap_width > 0` can be used to set a pixel unit line width. Any word (anything between two spaces without a newline) that goes beyond this width gets a newline inserted before it. [#1819](https://github.com/JuliaPlots/Makie.jl/pull/1819)
- Improved `Axis3`'s interactive performance. [#1835](https://github.com/JuliaPlots/Makie.jl/pull/1835)
Expand Down
32 changes: 32 additions & 0 deletions assets/fonts/LICENSES.md
Original file line number Diff line number Diff line change
Expand Up @@ -355,3 +355,35 @@ INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
OTHER DEALINGS IN THE FONT SOFTWARE.


# TeX Gyre Heros

% This is version 1.0, dated 22 June 2009, of the GUST Font License.
% (GUST is the Polish TeX Users Group, http://www.gust.org.pl)
%
% For the most recent version of this license see
% http://www.gust.org.pl/fonts/licenses/GUST-FONT-LICENSE.txt
% or
% http://tug.org/fonts/licenses/GUST-FONT-LICENSE.txt
%
% This work may be distributed and/or modified under the conditions
% of the LaTeX Project Public License, either version 1.3c of this
% license or (at your option) any later version.
%
% Please also observe the following clause:
% 1) it is requested, but not legally required, that derived works be
% distributed only after changing the names of the fonts comprising this
% work and given in an accompanying "manifest", and that the
% files comprising the Work, as listed in the manifest, also be given
% new names. Any exceptions to this request are also given in the
% manifest.
%
% We recommend the manifest be given in a separate file named
% MANIFEST-<fontid>.txt, where <fontid> is some unique identification
% of the font family. If a separate "readme" file accompanies the Work,
% we recommend a name of the form README-<fontid>.txt.
%
% The latest version of the LaTeX Project Public License is in
% http://www.latex-project.org/lppl.txt and version 1.3c or later
% is part of all distributions of LaTeX version 2006/05/20 or later.
Binary file added assets/fonts/TeXGyreHerosMakie-Bold.otf
Binary file not shown.
Binary file added assets/fonts/TeXGyreHerosMakie-BoldItalic.otf
Binary file not shown.
Binary file added assets/fonts/TeXGyreHerosMakie-Italic.otf
Binary file not shown.
Binary file added assets/fonts/TeXGyreHerosMakie-Regular.otf
Binary file not shown.
2 changes: 1 addition & 1 deletion docs/documentation/inspector.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ The `inspector = DataInspector(fig)` contains the following attributes:
- `text_align = (:left, :bottom)`: Alignment of text within the tooltip. This does not affect the alignment of the tooltip relative to the cursor.
- `textcolor = :black`: Tooltip text color.
- `textsize = 20`: Tooltip text size.
- `font = "Dejavu Sans"`: Tooltip font.
- `font = "TeX Gyre Heros Makie"`: Tooltip font.
- `background_color = :white`: Background color of the tooltip.
- `outline_color = :grey`: Outline color of the tooltip.
- `outline_linestyle = nothing`: Linestyle of the tooltip outline.
Expand Down
4 changes: 2 additions & 2 deletions docs/examples/plotting_functions/scatter.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,13 +76,13 @@ scatter(points, color = 1:30, markersize = range(5, 30, length = 30),
### Available markers

As markers, you can use almost any unicode character.
Currently, such glyphs are picked from the `Dejavu Sans` font, because it offers a wide range of symbols.
Currently, such glyphs are picked from the `TeX Gyre Heros Makie` font, because it offers a wide range of symbols.
There is also a number of markers that can be referred to as a symbol, so that it's not necessary to find out the respective unicode character.

The backslash character examples have to be tab-completed in the REPL or editor so they are converted into unicode.

!!! note
The scatter markers have the same sizes that the glyphs in Dejavu Sans have. This means that they are not matched in size or area. Currently, Makie does not have the option to use area matched markers, and sometimes manual adjustment might be necessary to achieve a good visual result.
The scatter markers have the same sizes that the glyphs in TeX Gyre Heros Makie have. This means that they are not matched in size or area. Currently, Makie does not have the option to use area matched markers, and sometimes manual adjustment might be necessary to achieve a good visual result.

\begin{examplefigure}{svg = true}
```julia
Expand Down
2 changes: 1 addition & 1 deletion docs/examples/plotting_functions/text.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
### Other

- `align::Tuple{Union{Symbol, Real}, Union{Symbol, Real}} = (:left, :bottom)` sets the alignment of the string w.r.t. `position`. Uses `:left, :center, :right, :top, :bottom, :baseline` or fractions.
- `font::Union{String, Vector{String}} = "Dejavu Sans"` sets the font for the string or each character.
- `font::Union{String, Vector{String}} = "TeX Gyre Heros Makie"` sets the font for the string or each character.
- `justification::Union{Real, Symbol} = automatic` sets the alignment of text w.r.t its bounding box. Can be `:left, :center, :right` or a fraction. Will default to the horizontal alignment in `align`.
- `position::Union{Point2f, Point3f} = Point2f(0)` sets an anchor position for text. Can also be a `Vector` of positions.
- `rotation::Union{Real, Quaternion}` rotates text around the given position.
Expand Down
19 changes: 14 additions & 5 deletions docs/tutorials/layout-tutorial.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,8 @@ using CairoMakie
using FileIO
CairoMakie.activate!() # hide

noto_sans = assetpath("fonts", "NotoSans-Regular.ttf")
noto_sans_bold = assetpath("fonts", "NotoSans-Bold.ttf")

f = Figure(backgroundcolor = RGBf(0.98, 0.98, 0.98),
resolution = (1000, 700), font = noto_sans)
resolution = (1000, 700))
```
\end{examplefigure}

Expand Down Expand Up @@ -89,6 +86,16 @@ f
```
\end{examplefigure}

We can also choose different x ticks with whole numbers.

\begin{examplefigure}{px_per_unit = 1.5}
```julia
axmain.xticks = 0:3:9

f
```
\end{examplefigure}

### Legend

We have set the `label` attribute in the scatter call so it's easier to construct the legend. We can just pass `axmain` as the second argument to `Legend`.
Expand Down Expand Up @@ -133,6 +140,7 @@ We can make a title by placing a label across the top two elements.
\begin{examplefigure}{px_per_unit = 1.5}
```julia
Label(ga[1, 1:2, Top()], "Stimulus ratings", valign = :bottom,
font = "TeX Gyre Heros Bold",
padding = (0, 0, 5, 0))

f
Expand Down Expand Up @@ -262,6 +270,7 @@ We can make a little title for the six axes by placing a `Label` in the top prot
\begin{examplefigure}{px_per_unit = 1.5}
```julia
Label(gd[1, :, Top()], "EEG traces", valign = :bottom,
font = "TeX Gyre Heros Bold",
padding = (0, 0, 5, 0))

f
Expand Down Expand Up @@ -333,7 +342,7 @@ That will leave all other alignments intact, because we're not creating any new
for (label, layout) in zip(["A", "B", "C", "D"], [ga, gb, gc, gd])
Label(layout[1, 1, TopLeft()], label,
textsize = 26,
font = noto_sans_bold,
font = "TeX Gyre Heros Bold",
padding = (0, 5, 5, 0),
halign = :right)
end
Expand Down
12 changes: 6 additions & 6 deletions src/conversions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -915,7 +915,7 @@ a string naming a font, e.g. helvetica
function to_font(x::Union{Symbol, String})
str = string(x)
get!(FONT_CACHE, str) do
str == "default" && return to_font("Dejavu Sans")
str == "default" && return to_font("TeX Gyre Heros Makie")

# check if the string points to a font file and load that
if isfile(str)
Expand All @@ -930,12 +930,12 @@ function to_font(x::Union{Symbol, String})
fontpath = assetpath("fonts")
font = FreeTypeAbstraction.findfont(str; additional_fonts=fontpath)
if font === nothing
@warn("Could not find font $str, using Dejavu Sans")
if "dejavu sans" == lowercase(str)
# since we fall back to dejavu sans, we need to check for recursion
error("Recursion encountered; DejaVu Sans cannot be located in the font path $fontpath")
@warn("Could not find font $str, using TeX Gyre Heros Makie")
if "tex gyre heros makie" == lowercase(str)
# since we fall back to TeX Gyre Heros Makie, we need to check for recursion
error("Recursion encountered; TeX Gyre Heros Makie cannot be located in the font path $fontpath")
end
return to_font("dejavu sans")
return to_font("TeX Gyre Heros Makie")
end
return font
end
Expand Down
2 changes: 1 addition & 1 deletion src/interaction/inspector.jl
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,7 @@ Defaults to the current plot when called without arguments.
does not affect the alignment of the tooltip relative to the cursor.
- `textcolor = :black`: Tooltip text color.
- `textsize = 20`: Tooltip text size.
- `font = "Dejavu Sans"`: Tooltip font.
- `font = "TeX Gyre Heros Makie"`: Tooltip font.
- `background_color = :white`: Background color of the tooltip.
- `outline_color = :grey`: Outline color of the tooltip.
- `outline_linestyle = nothing`: Linestyle of the tooltip outline.
Expand Down
Loading