[poincare/sequence_layout] Modified the height of sigma and product signs

Because of their previous even height, those symbols were not aligned with fractions. Now that they have an uneven size, they line up correctly.
This commit is contained in:
Arthur
2020-05-13 11:23:59 +02:00
committed by Émilie Feral
parent 45db7f1d48
commit bd74ab9718
2 changed files with 21 additions and 24 deletions

View File

@@ -8,7 +8,7 @@ namespace Poincare {
class SequenceLayoutNode : public LayoutNode {
public:
constexpr static KDCoordinate k_symbolHeight = 30;
constexpr static KDCoordinate k_symbolHeight = 29;
constexpr static KDCoordinate k_symbolWidth = 22;
using LayoutNode::LayoutNode;

View File

@@ -9,21 +9,21 @@ namespace Poincare {
// Stores a single branch of the sigma symbol
// Data is stored so that every two line a white pixel must be added. This way the branch's slope is respected
constexpr static int k_significantPixelWidth = 6;
const uint8_t symbolPixelOneBranch[(SumLayoutNode::k_symbolHeight/2-1)*k_significantPixelWidth] = {
0xF8, 0x2E, 0x9E, 0xFF, 0xFF, 0xFF,
0xFF, 0xD5, 0x15, 0xDB, 0xFF, 0xFF,
0xFF, 0x95, 0x35, 0xFA, 0xFF, 0xFF,
0xFF, 0xFE, 0x4C, 0x7A, 0xFF, 0xFF,
0xFF, 0xE9, 0x1B, 0xC0, 0xFF, 0xFF,
0xFF, 0xFF, 0xB7, 0x1F, 0xEE, 0xFF,
0xFF, 0xFF, 0x6F, 0x56, 0xFF, 0xFF,
0xFF, 0xFF, 0xF7, 0x2E, 0x9F, 0xFF,
0xFF, 0xFF, 0xD3, 0x16, 0xDB, 0xFF,
0xFF, 0xFF, 0xFF, 0x93, 0x37, 0xFA,
0xFF, 0xFF, 0xFE, 0x4B, 0x7B, 0xFF,
0xFF, 0xFF, 0xFF, 0xE8, 0x1A, 0xC0,
0xFF, 0xFF, 0xFF, 0xB6, 0x20, 0xEF,
0xFF, 0xFF, 0xFF, 0xFF, 0x6D, 0x57,
const uint8_t symbolPixelOneBranch[((SumLayoutNode::k_symbolHeight-1)/2)*k_significantPixelWidth] = {
0xF1, 0x21, 0xB2, 0xFF, 0xFF, 0xFF,
0xFF, 0xC5, 0x18, 0xE7, 0xFF, 0xFF,
0xFF, 0x7F, 0x46, 0xFE, 0xFF, 0xFF,
0xFF, 0xFC, 0x39, 0x8E, 0xFF, 0xFF,
0xFF, 0xDF, 0x15, 0xD0, 0xFF, 0xFF,
0xFF, 0xFF, 0xA4, 0x2A, 0xF6, 0xFF,
0xFF, 0xFF, 0x5A, 0x69, 0xFF, 0xFF,
0xFF, 0xFF, 0xF1, 0x21, 0xB2, 0xFF,
0xFF, 0xFF, 0xC5, 0x18, 0xE7, 0xFF,
0xFF, 0xFF, 0xFF, 0x7F, 0x46, 0xFE,
0xFF, 0xFF, 0xFC, 0x3A, 0x8E, 0xFF,
0xFF, 0xFF, 0xFF, 0xDF, 0x15, 0xD0,
0xFF, 0xFF, 0xFF, 0xA0, 0x20, 0xF6,
0xFF, 0xFF, 0XFF, 0xFF, 0xAB, 0x28,
};
int SumLayoutNode::serialize(char * buffer, int bufferSize, Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const {
@@ -35,15 +35,12 @@ void SumLayoutNode::render(KDContext * ctx, KDPoint p, KDColor expressionColor,
uint8_t symbolPixel[k_symbolHeight * k_symbolWidth];
int whiteOffset;
// Taking care of the first line which is a straight line
// First pixel is antialized
symbolPixel[0] = 0x70;
// The rest of the bar is black
for (int j = 1; j < k_symbolWidth; j++) {
// Taking care of the first line which is a black straight line
for (int j = 0; j < k_symbolWidth; j++) {
symbolPixel[j] = 0x00;
}
static_assert(k_symbolHeight%2 == 0, "sum_layout : k_symbolHeight is not even");
for (int i = 1; i < k_symbolHeight/2; i++) {
static_assert(k_symbolHeight%2 != 0, "sum_layout : k_symbolHeight is even");
for (int i = 1; i < (k_symbolHeight + 1)/2; i++) {
// Adding the white offset
whiteOffset = (i-1)/2;
for (int j = 0; j < whiteOffset; j++) {
@@ -62,7 +59,7 @@ void SumLayoutNode::render(KDContext * ctx, KDPoint p, KDColor expressionColor,
}
// Create real size sigma symbol by flipping the previous array
for (int i = k_symbolHeight/2; i < k_symbolHeight; i++) {
for (int i = k_symbolHeight/2 + 1; i < k_symbolHeight; i++) {
for (int j = 0; j < k_symbolWidth; j++) {
symbolPixel[i*k_symbolWidth + j] = symbolPixel[(k_symbolHeight-i-1)*k_symbolWidth +j];
}