Skip to content

Commit

Permalink
#303 go for it!
Browse files Browse the repository at this point in the history
  • Loading branch information
Mercury13 committed Aug 17, 2023
1 parent bf52a4e commit 25e63df
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 5 deletions.
18 changes: 14 additions & 4 deletions GlyphWiki2/KageLibs/kage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,22 @@ namespace {
CONNECT_VERTICAL = 32,
};

} // anon namespace


std::string kage::Glyph::toSvg() const
{
std::string r;

/// @todo [urgent] to Svg

return r;
}


///// Misc /////////////////////////////////////////////////////////////////////


SafeVector<std::string_view> kage::splitIntoLinesSv(std::string_view source)
{
return str::splitByAnySv(source, SEPARATORS);
Expand All @@ -69,15 +81,13 @@ kage::Glyph kage::toGlyph(std::string_view source, const SourceEngine& engine)
Glyph r;
auto lines = splitIntoLinesSv(source);
for (auto line : lines) {
auto& q = r.lines.emplace_back();
/// @todo [urgent] what to do with lines?
}
return r;
}

std::string kage::toSvg(std::string_view source, const SourceEngine& engine)
{
auto glyph = toGlyph(source, engine);
std::string r;

return r;
return toGlyph(source, engine).toSvg();
}
9 changes: 8 additions & 1 deletion GlyphWiki2/KageLibs/kage.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,19 @@ namespace kage {
};

constexpr std::string_view SEPARATORS = "\r" "\n" "$";
constexpr int SIZE = 200;

SafeVector<std::string_view> splitIntoLinesSv(std::string_view source);

using Line = Fix1d<float, 11>;
struct Line {
Fix1d<float, 11> d;
Line() noexcept
{ std::fill(d.begin(), d.end(), std::numeric_limits<float>::quiet_NaN()); }
};

struct Glyph {
SafeVector<Line> lines;
std::string toSvg() const;
};

Glyph toGlyph(std::string_view source, const SourceEngine& engine);
Expand Down

0 comments on commit 25e63df

Please sign in to comment.