Skip to content

Commit 8e76a6d

Browse files
Clang Robotcpp-niel
authored andcommitted
🎨 Committing clang-format changes
1 parent 51cc943 commit 8e76a6d

56 files changed

Lines changed: 730 additions & 1350 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

include/mfl/abstract_font_face.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,8 @@ namespace mfl
7373
virtual ~abstract_font_face() = default;
7474
[[nodiscard]] virtual math_constants constants() const = 0;
7575
[[nodiscard]] virtual math_glyph_info glyph_info(const size_t glyph_index) const = 0;
76-
[[nodiscard]] virtual size_t glyph_index_from_code_point(const code_point char_code, const bool use_large_variant) const = 0;
76+
[[nodiscard]] virtual size_t glyph_index_from_code_point(const code_point char_code,
77+
const bool use_large_variant) const = 0;
7778
[[nodiscard]] virtual std::vector<size_variant> horizontal_size_variants(const code_point char_code) const = 0;
7879
[[nodiscard]] virtual std::vector<size_variant> vertical_size_variants(const code_point char_code) const = 0;
7980
virtual void set_size(const points size) = 0;

include/mfl/layout.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,5 +38,6 @@ namespace mfl
3838
std::optional<std::string> error;
3939
};
4040

41-
layout_elements layout(const std::string_view input, const points font_size, const font_face_creator& create_font_face);
41+
layout_elements layout(const std::string_view input, const points font_size,
42+
const font_face_creator& create_font_face);
4243
}

include/mfl/units.hpp

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,15 +48,23 @@ namespace mfl
4848

4949
namespace fmt
5050
{
51-
template<>
52-
struct [[maybe_unused]] formatter<mfl::inches> : mfl::unit_formatter<mfl::inches, '\"'> {};
51+
template <>
52+
struct [[maybe_unused]] formatter<mfl::inches> : mfl::unit_formatter<mfl::inches, '\"'>
53+
{
54+
};
5355

5456
template <>
55-
struct [[maybe_unused]] formatter<mfl::dots_per_inch> : mfl::unit_formatter<mfl::dots_per_inch, 'd', 'p', 'i'> {};
57+
struct [[maybe_unused]] formatter<mfl::dots_per_inch> : mfl::unit_formatter<mfl::dots_per_inch, 'd', 'p', 'i'>
58+
{
59+
};
5660

5761
template <>
58-
struct [[maybe_unused]] formatter<mfl::pixels> : mfl::unit_formatter<mfl::pixels, 'p', 'x'> {};
62+
struct [[maybe_unused]] formatter<mfl::pixels> : mfl::unit_formatter<mfl::pixels, 'p', 'x'>
63+
{
64+
};
5965

6066
template <>
61-
struct [[maybe_unused]] formatter<mfl::points> : mfl::unit_formatter<mfl::points, 'p', 't'> {};
67+
struct [[maybe_unused]] formatter<mfl::points> : mfl::unit_formatter<mfl::points, 'p', 't'>
68+
{
69+
};
6270
}

src/font_library.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ namespace mfl
1717
const auto capital_m_index = face.glyph_index_from_code_point('M', false);
1818
const auto capital_m_width = face.glyph_info(capital_m_index).width;
1919

20-
return {.size = size, .x_height = x_height, .capital_m_width = capital_m_width, .math_info = face.constants()};
20+
return {
21+
.size = size, .x_height = x_height, .capital_m_width = capital_m_width, .math_info = face.constants()};
2122
}
2223
}
2324

src/noad/gen_script.cpp

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -92,9 +92,8 @@ namespace mfl
9292
dist_t sup_pos(const settings s, const cramping cramp, const bool is_nucleus_single_character,
9393
const dist_t nuc_height, const dist_t sup_depth)
9494
{
95-
const auto candidate_positions =
96-
std::array{sup_pos0(s, is_nucleus_single_character, nuc_height), superscript_shift(s, cramp),
97-
sup_depth + (x_height(s) / 4)};
95+
const auto candidate_positions = std::array{sup_pos0(s, is_nucleus_single_character, nuc_height),
96+
superscript_shift(s, cramp), sup_depth + (x_height(s) / 4)};
9897
return std::ranges::max(candidate_positions);
9998
}
10099

@@ -170,8 +169,7 @@ namespace mfl
170169

171170
if (sub_box && !sup_box) return make_subscript_hlist(s, std::move(nucleus), std::move(*sub_box));
172171

173-
if (!sub_box && sup_box)
174-
return make_superscript_hlist(s, cramp, std::move(nucleus), std::move(*sup_box));
172+
if (!sub_box && sup_box) return make_superscript_hlist(s, cramp, std::move(nucleus), std::move(*sup_box));
175173

176174
return make_dual_scripts_hlist(s, cramp, std::move(nucleus), std::move(*sub_box), std::move(*sup_box));
177175
}
@@ -184,9 +182,8 @@ namespace mfl
184182
}
185183
}
186184

187-
template<gen_script Script>
188-
hlist gen_script_to_hlist(const settings s, const cramping cramp, const bool use_limit_pos,
189-
const Script& n)
185+
template <gen_script Script>
186+
hlist gen_script_to_hlist(const settings s, const cramping cramp, const bool use_limit_pos, const Script& n)
190187
{
191188
constexpr auto is_big_op = std::is_same_v<decltype(n), const big_op&>;
192189
auto nucleus = make_nucleus(s, cramp, is_big_op, n.nucleus);

src/noad/gen_script.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ namespace mfl
2323
template <typename ScriptNoad>
2424
concept gen_script = std::is_same_v<ScriptNoad, big_op> || std::is_same_v<ScriptNoad, script>;
2525

26-
template<gen_script Script>
26+
template <gen_script Script>
2727
[[nodiscard]] hlist gen_script_to_hlist(const settings s, const cramping cramp, const bool use_limit_pos,
2828
const Script& n);
2929
}

src/noad/left_right.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,14 @@ namespace mfl
1212
const auto requested_height = content.dims.depth + content.dims.height;
1313
hlist result;
1414
if (l.left_delim_code != 0)
15-
result.nodes.emplace_back(make_auto_height_glyph(s, font_family::roman, l.left_delim_code, requested_height).first);
15+
result.nodes.emplace_back(
16+
make_auto_height_glyph(s, font_family::roman, l.left_delim_code, requested_height).first);
1617

1718
result.nodes.emplace_back(std::move(content));
1819

1920
if (l.right_delim_code != 0)
20-
result.nodes.emplace_back(make_auto_height_glyph(s, font_family::roman, l.right_delim_code, requested_height).first);
21+
result.nodes.emplace_back(
22+
make_auto_height_glyph(s, font_family::roman, l.right_delim_code, requested_height).first);
2123

2224
return result;
2325
}

src/noad/math_char.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,13 @@ namespace mfl
99
namespace
1010
{
1111
std::size_t find_best_size_glyph_index(const abstract_font_face& face, const code_point char_code,
12-
const dist_t requested_size, const bool is_horizontal)
12+
const dist_t requested_size, const bool is_horizontal)
1313
{
1414
using namespace units_literals;
1515
const auto variants =
1616
is_horizontal ? face.horizontal_size_variants(char_code) : face.vertical_size_variants(char_code);
1717

18-
if (variants.empty())
19-
return face.glyph_index_from_code_point(char_code, false);
18+
if (variants.empty()) return face.glyph_index_from_code_point(char_code, false);
2019

2120
auto result = variants.front().glyph_index;
2221
for (const auto v : variants)

src/noad/math_char.hpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
#pragma once
22

3+
#include "dist.hpp"
34
#include "mfl/code_point.hpp"
45
#include "mfl/font_family.hpp"
56
#include "noad/item_kind.hpp"
6-
#include "dist.hpp"
77

88
#include <utility>
99

@@ -30,10 +30,12 @@ namespace mfl
3030
const code_point char_code, const bool use_large_variant);
3131

3232
std::pair<glyph, horizontal_correction> make_auto_width_glyph(const settings s, const font_family family,
33-
const code_point char_code, const dist_t requested_width);
33+
const code_point char_code,
34+
const dist_t requested_width);
3435

3536
std::pair<glyph, horizontal_correction> make_auto_height_glyph(const settings s, const font_family family,
36-
const code_point char_code, const dist_t requested_height);
37+
const code_point char_code,
38+
const dist_t requested_height);
3739

3840
hlist math_char_to_hlist(const settings s, const math_char& mc);
3941
}

src/noad/noad.cpp

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
#include "noad/noad.hpp"
22

3-
#include "node/hlist.hpp"
43
#include "mlist_with_kind.hpp"
54
#include "noad/accent.hpp"
65
#include "noad/big_op.hpp"
@@ -12,6 +11,7 @@
1211
#include "noad/script.hpp"
1312
#include "noad/underline.hpp"
1413
#include "node/box.hpp"
14+
#include "node/hlist.hpp"
1515
#include "settings.hpp"
1616

1717
#include <algorithm>
@@ -39,22 +39,20 @@ namespace mfl
3939

4040
hlist noad_to_hlist(const settings s, const cramping cramp, const noad& n)
4141
{
42-
return std::visit(
43-
overload{[&](const math_char& c) { return math_char_to_hlist(s, c); },
44-
[&](const radical& r) { return radical_to_hlist(s, cramp, r); },
45-
[&](const accent& a) { return accent_to_hlist(s, cramp, a); },
46-
[](const vcenter&) { return hlist{}; },
47-
[&](const overline& o) { return overline_to_hlist(s, cramp, o); },
48-
[&](const underline& u) { return underline_to_hlist(s, cramp, u); },
49-
[&](const fraction& f) { return fraction_to_hlist(s, cramp, f); },
50-
[&](const left_right& l) { return left_right_to_hlist(s, cramp, l); },
51-
[&](const script& sc) { return script_to_hlist(s, cramp, sc); },
52-
[&](const big_op& b) { return big_op_to_hlist(s, cramp, b); },
53-
[](const math_space&) { return hlist{}; },
54-
[&](const mlist& m) { return to_hlist(s, cramp, false, m.noads); },
55-
[&](const mlist_with_kind& m) { return to_hlist(s, cramp, false, m.noads); }
56-
},
57-
n);
42+
return std::visit(overload{[&](const math_char& c) { return math_char_to_hlist(s, c); },
43+
[&](const radical& r) { return radical_to_hlist(s, cramp, r); },
44+
[&](const accent& a) { return accent_to_hlist(s, cramp, a); },
45+
[](const vcenter&) { return hlist{}; },
46+
[&](const overline& o) { return overline_to_hlist(s, cramp, o); },
47+
[&](const underline& u) { return underline_to_hlist(s, cramp, u); },
48+
[&](const fraction& f) { return fraction_to_hlist(s, cramp, f); },
49+
[&](const left_right& l) { return left_right_to_hlist(s, cramp, l); },
50+
[&](const script& sc) { return script_to_hlist(s, cramp, sc); },
51+
[&](const big_op& b) { return big_op_to_hlist(s, cramp, b); },
52+
[](const math_space&) { return hlist{}; },
53+
[&](const mlist& m) { return to_hlist(s, cramp, false, m.noads); },
54+
[&](const mlist_with_kind& m) { return to_hlist(s, cramp, false, m.noads); }},
55+
n);
5856
}
5957

6058
ilist noads_to_intermediate_terms(const settings s, const cramping cramp, const std::vector<noad>& noads)
@@ -65,8 +63,7 @@ namespace mfl
6563
if (std::holds_alternative<math_space>(n)) { result.terms.emplace_back(std::get<math_space>(n)); }
6664
else
6765
{
68-
result.terms.emplace_back(
69-
inoad{.translated_noad = noad_to_hlist(s, cramp, n), .kind = kind(n)});
66+
result.terms.emplace_back(inoad{.translated_noad = noad_to_hlist(s, cramp, n), .kind = kind(n)});
7067
}
7168
}
7269

@@ -112,12 +109,11 @@ namespace mfl
112109
{.left = item_kind::op, .right = item_kind::ord, .space = thin_skip_always}};
113110

114111
const auto is_entry_for_items = [&](const table_entry& e) {
115-
return (((e.left == left) or (e.left == item_kind::any)) and
116-
((e.right == right) or (e.right == item_kind::any)));
112+
return (((e.left == left) or (e.left == item_kind::any))
113+
and ((e.right == right) or (e.right == item_kind::any)));
117114
};
118115

119-
if (const auto it = std::ranges::find_if(table, is_entry_for_items); it != table.end())
120-
return it->space;
116+
if (const auto it = std::ranges::find_if(table, is_entry_for_items); it != table.end()) return it->space;
121117

122118
return std::nullopt;
123119
}
@@ -151,8 +147,8 @@ namespace mfl
151147

152148
item_kind kind_of_next_inoad(const std::span<const intermediate_term> iterms)
153149
{
154-
const auto it =
155-
std::ranges::find_if(iterms, [](const intermediate_term& t) { return std::holds_alternative<inoad>(t); });
150+
const auto it = std::ranges::find_if(
151+
iterms, [](const intermediate_term& t) { return std::holds_alternative<inoad>(t); });
156152

157153
return it == iterms.end() ? item_kind::none : std::get<inoad>(*it).kind;
158154
}
@@ -171,7 +167,8 @@ namespace mfl
171167
return std::ranges::find(kinds, kind) != kinds.end();
172168
}
173169

174-
item_kind change_kind(const item_kind prev_kind, const item_kind kind, const std::span<const intermediate_term> iterms)
170+
item_kind change_kind(const item_kind prev_kind, const item_kind kind,
171+
const std::span<const intermediate_term> iterms)
175172
{
176173
if (kind != item_kind::bin) return kind;
177174

@@ -194,7 +191,8 @@ namespace mfl
194191
kind = change_kind(prev_kind, n.kind, tail);
195192
const auto space = make_space(s, math_spacing(prev_kind, n.kind));
196193
result.nodes.insert(result.nodes.end(), space.nodes.begin(), space.nodes.end());
197-
result.nodes.insert(result.nodes.end(), n.translated_noad.nodes.begin(), n.translated_noad.nodes.end());
194+
result.nodes.insert(result.nodes.end(), n.translated_noad.nodes.begin(),
195+
n.translated_noad.nodes.end());
198196
}
199197
else if (std::holds_alternative<ispace>(term))
200198
{
@@ -216,7 +214,9 @@ namespace mfl
216214
item_kind nucleus_kind(const script& s)
217215
{
218216
if ((s.nucleus.size() == 1) && (std::holds_alternative<math_char>(s.nucleus.front())))
219-
{ return std::get<math_char>(s.nucleus.front()).kind; }
217+
{
218+
return std::get<math_char>(s.nucleus.front()).kind;
219+
}
220220

221221
return item_kind::ord;
222222
}

0 commit comments

Comments
 (0)