Skip to content

Commit

Permalink
Add fancer text and clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
dylwhich committed Dec 7, 2022
1 parent 7020b31 commit db710d8
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 19 deletions.
2 changes: 1 addition & 1 deletion assets/texts/manual/manual_intro.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

---

Now in Swadge Format!
Now in _~\c500S\c530w\c550a\c050d\c005g\c505e\C\C\C\C\C\C~_ Format!

Welcome to the _new and improved_ MAGFest 2023 Swadge!

Expand Down
9 changes: 8 additions & 1 deletion assets/texts/manual/manual_stresstest.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
Hello this is some _rich_ text! So **bold** and \*\*escapey\*\* and all, or \\**not*\\*.
Hello this is some _rich_ text! So **bold** and \*\*escapey\*\* and all, or \\*\*not\**\\.
I really ~~wasted a lot of time~~ ~worked hard~ on this!
DOES THIS INTERFERE WITH THE UNDERLINE ~let's underline a lot of things eh i WANNA see what happens when we get to the top of it~

---

#\c500R\c530A\c550I\c050N\c005B\c055O\c505W\C\C\C\C\C\C\C

#Important Thing

# Huh, how big can it be

#What about a very big header that has more than one line that probably won't work right or maybe it will who knows


Something less --- important

*heywhathappensififillupanentirelinedoesthatstillworkbecauseididdeletesomethingthathandlesthatwellseeohwellmaybeanotherfiftyorsocharactersshouldbegoodtomakesurethateverything'sok* how's that
28 changes: 11 additions & 17 deletions main/utils/markdown_parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -1249,23 +1249,8 @@ static void leavingNode(const mdNode_t* node, mdPrintState_t* state)
}
else if (node->option.type == STYLE)
{
textStyle_t newStyle = findPreviousStyles(node, state);
// Check if the current style is italic, and the new style is not
/*if (node->option.style & STYLE_ITALIC && !(newStyle & STYLE_ITALIC))
{
// If that's the case, we need to account for the extra width of italics!
state->x += textWidthAttrs(state->font, "", state->params.style);
// Check if we need to wrap
if (state->x > state->params.xMax)
{
state->x = state->params.xMin;
state->y += textLineHeight(state->font, state->params.style);
}
}*/

// Actually set the new style
state->params.style = newStyle;
// Just set the new style
state->params.style = findPreviousStyles(node, state);
}
else
{
Expand Down Expand Up @@ -1505,6 +1490,15 @@ static const char* planLine(display_t* disp, const mdNode_t* node, mdPrintState_
const char* remainingText = node->text.start + state->textPos;
state->textPos = 0;

// TODO: OPTIMIZATION!
// - Measure the entire text using `drawTextWordWrapExtra(NULL, ...)`
// - Because the height is uniform, we can just determine the number of lines to draw
// - Measure and add the remainder to the plan
// - Draw the planned line as usual
// - Then draw all but the last remaining line without involving the line planner
// - (but then we can't do centering... worry about thta later, it's not too much harder)
// - Add the remainder to the plan as usual

while (remainingText != NULL)
{
int16_t lineHeight = textLineHeight(state->font, state->params.style);
Expand Down

0 comments on commit db710d8

Please sign in to comment.