Exemplo n.º 1
0
qreal Formulaeditor::sign_factor(qint32& nPosition, QString& strCharacter)
{
  if (strCharacter == "-")
    {
        char_n(nPosition, strCharacter);
        return (-1.0) * factor(nPosition, strCharacter);
    }
  else return factor(nPosition, strCharacter);
}
Exemplo n.º 2
0
double Formulaeditor::term(int& nPosition, QString& strCharacter)
{
  qreal t,vz;
  t = sign_factor(nPosition, strCharacter);
  while (strCharacter == "^")
  {
      char_n(nPosition, strCharacter);
      vz = sign_factor(nPosition, strCharacter);

      if ((t <= 0 && fabs(vz) <= 1) || (t <= 0 && vz != qint32(vz))) errorText = QString("Extraction of square root of negative numbers is not possible using dense matrix algebra.");
      else    t = pow(t,vz);
  }
  return t;
}
Exemplo n.º 3
0
double Formulaeditor::expression(int& nPosition, QString& strCharacter)
{
  QString strOperator;
  double erg = simple_expression(nPosition, strCharacter);
  while (strCharacter == "+" || strCharacter == "-")
  {
    strOperator = strCharacter;
    char_n(nPosition, strCharacter);
    if (strOperator == "+")
        erg += simple_expression(nPosition, strCharacter);
    else if (strOperator == "-")
        erg -= simple_expression(nPosition, strCharacter);
  }

  return erg;
}
Exemplo n.º 4
0
double Formulaeditor::simple_expression(int& nPosition, QString& strCharacter)
{
    double s,dum;
    QString strOperator;
    s = term(nPosition, strCharacter);
    while (strCharacter == "*" || strCharacter == "/")
    {
        strOperator = strCharacter;
        char_n(nPosition, strCharacter);
        if (strOperator == "*")
            s = s * term(nPosition, strCharacter);
        else if (strOperator == "/")
        {
            dum = term(nPosition, strCharacter);
            if (dum != 0)   s = s / dum;
            else    errorText = QString("Divide by 0 is not possible.");
        }
    }
    return s;
}
Exemplo n.º 5
0
double Formulaeditor::calculation(QString strFormula, qreal xValue, bool strip)
{
    qint32  nPosition;
    QString strCharacter;
    qreal	result;

    if (strFormula.length() < 1) return 0.0;

    m_strErrortext = "";

    if (strip) strip_formula(strFormula);

    m_strFunction = strFormula;
    m_dFktValue = xValue;
    if (m_dFktValue == 0)
    m_dFktValue = FLT_MIN;
    nPosition = 0;
    char_n(nPosition, strCharacter);

    result = expression(nPosition, strCharacter);

    return result;
}
Exemplo n.º 6
0
double Formulaeditor::factor(qint32& nPosition, QString& strCharacter)
{
    qreal f = 0.0;
    qint32 wI = 0, wL = 0, wBeginn = 0, wError = 0;

    if	(strCharacter == str_char(0)) return 0.0;
    // read digit and save as float in f
    if (((strCharacter >= "0") && (strCharacter <= "9")) || (strCharacter == "."))
    {
        wBeginn = nPosition;

        do
        {
            char_n(nPosition, strCharacter);
        }
        while ((((strCharacter >= "0") && (strCharacter <= "9")) || (strCharacter == ".")));

        if (strCharacter == ".")
        {
            do
            {
                char_n(nPosition, strCharacter);
            }
            while (!(((qint8)strCharacter.at(0).digitValue() >= 0) && ((qint8)strCharacter.at(0).digitValue() <=  9))  || (strCharacter.at(0) == '.'));
        }

        QString g_strF = m_strFunction.mid(wBeginn - 1, nPosition - wBeginn);
        f = g_strF.toFloat();
    }
    else
    {
        QString strCharacterUpper = strCharacter.toUpper();
        if (strCharacter == "(")
        {
            char_n(nPosition, strCharacter);
            f = expression(nPosition, strCharacter);
            if (strCharacter == ")")
                char_n(nPosition, strCharacter);
        }
        else if (strCharacterUpper == "X")
        {
            char_n(nPosition, strCharacter);
            f = m_dFktValue;
        }
        else
        {
            bool gefunden = false;
            qint32 AnzStdFunctions = m_strStandardFunction.length() - 1;
            for (wI = 1; wI <= AnzStdFunctions; wI++)
            {
                wL = m_strStandardFunction.at(wI).length();
                QString strFunktionUpper = m_strFunction.mid(nPosition - 1, wL);
                strFunktionUpper = strFunktionUpper.toUpper();
                QString strDummy(m_strStandardFunction.at(wI));
                strDummy = strDummy.toUpper();
                if (strFunktionUpper == strDummy)
                {
                    gefunden = true;
                    nPosition = nPosition + wL - 1;
                    char_n(nPosition, strCharacter);
                    // ! recursion !!!!!!!!!!!!!!!!!!!!!!
                    f = factor(nPosition, strCharacter);
                    //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
                    if (strFunktionUpper == "ABS")
                        f = fabs(f);
                    else if (strFunktionUpper == "SQRT")
                        if (f >= 0)
                            f = sqrt(f);
                        else
                            wError = -1;
                    else if (strFunktionUpper == "SINH")
                        f = sinh(f);
                    else if (strFunktionUpper == "COSH")
                        f = cosh(f);
                    else if (strFunktionUpper == "TANH")
                        f = tanh(f);
                    else if (strFunktionUpper == "ARCTAN")
                        f = atan(f);
                    else if (strFunktionUpper == "LN")
                    {
                        if (f >= 0)
                            f = log(f);
                        else
                            wError = -1;
                    }
                    else if (strFunktionUpper == "LOG")
                    {
                        if (f >= 0)
                            f = log10(f);
                        else
                            wError = -1;
                    }
                    else if (strFunktionUpper == "EXP")
                    {
                        //if (f <= 41)
                            f = exp(f);
                        //else
                            //wError = -1;
                    }
                    else if (strFunktionUpper == "SIN")
                        f = sin(f);
                    else if (strFunktionUpper == "COS")
                        f = cos(f);
                    else if (strFunktionUpper == "COT")
                        f = cot(f);
                    else if (strFunktionUpper == "TAN")
                    {
                        if (cos(f) != 0)
                            f = tan(f);
                        else
                            wError = -1;
                    }
                    else if (strFunktionUpper == "ARCSIN")
                    {
                        if (fabs(f) < 1)
                            f = asin(f);
                        else
                            wError = -1;
                    }
                    else if (strFunktionUpper == "ARCCOS")
                    {
                        if (fabs(f) <= 1)
                            f = acos(f);
                        else
                            wError = -1;
                    }
                    else if (strFunktionUpper == "SIGN")
                        f = signl(f);                    
                    else if (strFunktionUpper == "RAD")
                        f = RAD(f);
                    else if (strFunktionUpper == "DEG")
                        f = DEG(f);
                    else if (strFunktionUpper == "ARSINH")
                        f = ArSinh(f);                   
                    else if (strFunktionUpper == "ARCOSH")
                    {
                        if (fabs(f) >= 1)
                            f = ArCosh(f);
                        else
                            wError = -1;
                    }
                    else if (strFunktionUpper == "ARTANH")
                    {
                        if (fabs(f) <= 1)
                            f = ArTanh(f);
                        else
                            wError = -1;
                    }
                    break;
                }
            }
            if (!gefunden)
            {
                char_n(nPosition, strCharacter);
                if (strCharacterUpper == "A")
                    f = m_dFunctionConstant[0];
                else if (strCharacterUpper == "B")
                    f = m_dFunctionConstant[1];
                else if (strCharacterUpper == "C")
                    f = m_dFunctionConstant[2];
                else if (strCharacterUpper == "D")
                    f = m_dFunctionConstant[3];
                else if (strCharacterUpper == "E")
                    f = m_dFunctionConstant[4];
                else if (strCharacterUpper == "F")
                    f = m_dFunctionConstant[5];
                else if (strCharacterUpper == "G")
                    f = m_dFunctionConstant[6];
                else if (strCharacterUpper == "H")
                    f = m_dFunctionConstant[7];
            }
        }
    }

    if (wError == -1)           errorText = QString("General Parser Error blocked!");

    return f;
}
Exemplo n.º 7
0
struct Character char_A() {
    // bitmap: char_A
    // using: default_font_palette
    static int32_t pixels[6*7] = {
        0, 0, 0, 0, 0, 0,
        0, 0, 1, 1, 0, 0,
        0, 1, 0, 0, 1, 0,
        0, 1, 1, 1, 1, 0,
        0, 1, 0, 0, 1, 0,
        0, 1, 0, 0, 1, 0,
        0, 0, 0, 0, 0, 0
    };
    struct Character r = { .w = 6, .h = 7, .pixels = pixels };
    return r;
}

struct Character char_a() {
    static int32_t pixels[6*6] = {
        0, 0, 0, 0, 0, 0,
        0, 0, 1, 1, 0, 0,
        0, 1, 0, 0, 1, 0,
        0, 1, 0, 0, 1, 0,
        0, 0, 1, 1, 1, 0,
        0, 0, 0, 0, 0, 0
    };
    struct Character r = { .w = 6, .h = 6, .pixels = pixels };
    return r;
}

struct Character char_B() {
    static int32_t pixels[6*7] = {
        0, 0, 0, 0, 0, 0,
        0, 1, 1, 1, 0, 0,
        0, 1, 0, 0, 1, 0,
        0, 1, 1, 1, 0, 0,
        0, 1, 0, 0, 1, 0,
        0, 1, 1, 1, 0, 0,
        0, 0, 0, 0, 0, 0
    };
    struct Character r = { .w = 6, .h = 7, .pixels = pixels };
    return r;
}

struct Character char_b() {
    static int32_t pixels[5*7] = {
        0, 0, 0, 0, 0,
        0, 1, 0, 0, 0,
        0, 1, 0, 0, 0,
        0, 1, 1, 1, 0,
        0, 1, 0, 1, 0,
        0, 1, 1, 0, 0,
        0, 0, 0, 0, 0
    };
    struct Character r = { .w = 5, .h = 7, .pixels = pixels };
    return r;
}

struct Character char_C() {
    static int32_t pixels[6*7] = {
        0, 0, 0, 0, 0, 0,
        0, 0, 1, 1, 1, 0,
        0, 1, 0, 0, 0, 0,
        0, 1, 0, 0, 0, 0,
        0, 1, 0, 0, 0, 0,
        0, 0, 1, 1, 1, 0,
        0, 0, 0, 0, 0, 0
    };
    struct Character r = { .w = 6, .h = 7, .pixels = pixels };
    return r;
}

struct Character char_c() {
    static int32_t pixels[5*6] = {
        0, 0, 0, 0, 0,
        0, 0, 1, 1, 0,
        0, 1, 0, 0, 0,
        0, 1, 0, 0, 0,
        0, 0, 1, 1, 0,
        0, 0, 0, 0, 0
    };
    struct Character r = { .w = 5, .h = 6, .pixels = pixels };
    return r;
}

struct Character char_D() {
    static int32_t pixels[6*7] = {
        0, 0, 0, 0, 0, 0,
        0, 1, 1, 1, 0, 0,
        0, 1, 0, 0, 1, 0,
        0, 1, 0, 0, 1, 0,
        0, 1, 0, 0, 1, 0,
        0, 1, 1, 1, 0, 0,
        0, 0, 0, 0, 0, 0
    };
    struct Character r = { .w = 6, .h = 7, .pixels = pixels };
    return r;
}

struct Character char_d() {
    static int32_t pixels[5*7] = {
        0, 0, 0, 0, 0,
        0, 0, 0, 1, 0,
        0, 0, 0, 1, 0,
        0, 0, 1, 1, 0,
        0, 1, 0, 1, 0,
        0, 1, 1, 1, 0,
        0, 0, 0, 0, 0,
    };
    struct Character r = { .w = 5, .h = 7, .pixels = pixels };
    return r;
}

struct Character char_E() {
    static int32_t pixels[5*7] = {
        0, 0, 0, 0, 0,
        0, 1, 1, 1, 0,
        0, 1, 0, 0, 0,
        0, 1, 1, 1, 0,
        0, 1, 0, 0, 0,
        0, 1, 1, 1, 0,
        0, 0, 0, 0, 0,
    };
    struct Character r = { .w = 5, .h = 7, .pixels = pixels };
    return r;
}

struct Character char_e() {
    static int32_t pixels[5*6] = {
        0, 0, 0, 0, 0,
        0, 0, 1, 0, 0,
        0, 1, 1, 1, 0,
        0, 1, 0, 0, 0,
        0, 0, 1, 1, 0,
        0, 0, 0, 0, 0,
    };
    struct Character r = { .w = 5, .h = 6, .pixels = pixels };
    return r;
}

struct Character char_F() {
    static int32_t pixels[5*7] = {
        0, 0, 0, 0, 0,
        0, 1, 1, 1, 0,
        0, 1, 0, 0, 0,
        0, 1, 1, 1, 0,
        0, 1, 0, 0, 0,
        0, 1, 0, 0, 0,
        0, 0, 0, 0, 0,
    };
    struct Character r = { .w = 5, .h = 7, .pixels = pixels };
    return r;
}

struct Character char_f() {
    static int32_t pixels[4*7] = {
        0, 0, 0, 0,
        0, 0, 1, 0,
        0, 1, 0, 0,
        0, 1, 1, 0,
        0, 1, 0, 0,
        0, 1, 0, 0,
        0, 0, 0, 0
    };
    struct Character r = { .w = 4, .h = 7, .pixels = pixels };
    return r;
}

struct Character char_G() {
    static int32_t pixels[6*7] = {
        0, 0, 0, 0, 0, 0,
        0, 0, 1, 1, 1, 0,
        0, 1, 0, 0, 0, 0,
        0, 1, 0, 1, 1, 0,
        0, 1, 0, 0, 1, 0,
        0, 0, 1, 1, 1, 0,
        0, 0, 0, 0, 0, 0
    };
    struct Character r = { .w = 6, .h = 7, .pixels = pixels };
    return r;
}

struct Character char_g() {
    static int32_t pixels[5*6] = {
        0, 0, 0, 0, 0,
        0, 0, 1, 0, 0,
        0, 1, 0, 1, 0,
        0, 0, 1, 1, 0,
        0, 0, 0, 1, 0,
        0, 1, 1, 0, 0
    };
    struct Character r = { .w = 5, .h = 6, .pixels = pixels };
    return r;
}

struct Character char_H() {
    static int32_t pixels[6*7] = {
        0, 0, 0, 0, 0, 0,
        0, 1, 0, 0, 1, 0,
        0, 1, 0, 0, 1, 0,
        0, 1, 1, 1, 1, 0,
        0, 1, 0, 0, 1, 0,
        0, 1, 0, 0, 1, 0,
        0, 0, 0, 0, 0, 0
    };
    struct Character r = { .w = 6, .h = 7, .pixels = pixels };
    return r;
}

struct Character char_h() {
    static int32_t pixels[5*7] = {
        0, 0, 0, 0, 0,
        0, 1, 0, 0, 0,
        0, 1, 0, 0, 0,
        0, 1, 1, 0, 0,
        0, 1, 0, 1, 0,
        0, 1, 0, 1, 0,
        0, 0, 0, 0, 0
    };
    struct Character r = { .w = 5, .h = 7, .pixels = pixels };
    return r;
}

struct Character char_I() {
    static int32_t pixels[5*7] = {
        0, 0, 0, 0, 0,
        0, 1, 1, 1, 0,
        0, 0, 1, 0, 0,
        0, 0, 1, 0, 0,
        0, 0, 1, 0, 0,
        0, 1, 1, 1, 0,
        0, 0, 0, 0, 0
    };
    struct Character r = { .w = 5, .h = 7, .pixels = pixels };
    return r;
}

struct Character char_i() {
    static int32_t pixels[5*7] = {
        0, 0, 0, 0, 0,
        0, 0, 1, 0, 0,
        0, 0, 0, 0, 0,
        0, 1, 1, 0, 0,
        0, 0, 1, 0, 0,
        0, 0, 1, 1, 0,
        0, 0, 0, 0, 0
    };
    struct Character r = { .w = 5, .h = 7, .pixels = pixels };
    return r;
}
struct Character char_J() {
    static int32_t pixels[6*7] = {
        0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 1, 0,
        0, 0, 0, 0, 1, 0,
        0, 0, 0, 0, 1, 0,
        0, 1, 0, 0, 1, 0,
        0, 0, 1, 1, 0, 0,
        0, 0, 0, 0, 0, 0
    };
    struct Character r = { .w = 6, .h = 7, .pixels = pixels };
    return r;
}

struct Character char_j() {
    static int32_t pixels[5*7] = {
        0, 0, 0, 0, 0,
        0, 0, 0, 1, 0,
        0, 0, 0, 0, 0,
        0, 0, 1, 1, 0,
        0, 0, 0, 1, 0,
        0, 1, 0, 1, 0,
        0, 0, 1, 0, 0
    };
    struct Character r = { .w = 5, .h = 7, .pixels = pixels };
    return r;
}

struct Character char_K() {
    static int32_t pixels[6*7] = {
        0, 0, 0, 0, 0, 0,
        0, 1, 0, 0, 1, 0,
        0, 1, 0, 1, 0, 0,
        0, 1, 1, 0, 0, 0,
        0, 1, 0, 1, 0, 0,
        0, 1, 0, 0, 1, 0,
        0, 0, 0, 0, 0, 0
    };
    struct Character r = { .w = 6, .h = 7, .pixels = pixels };
    return r;
}

struct Character char_k() {
    static int32_t pixels[5*7] = {
        0, 0, 0, 0, 0,
        0, 1, 0, 0, 0,
        0, 1, 0, 0, 0,
        0, 1, 0, 1, 0,
        0, 1, 1, 0, 0,
        0, 1, 0, 1, 0,
        0, 0, 0, 0, 0
    };
    struct Character r = { .w = 5, .h = 7, .pixels = pixels };
    return r;
}

struct Character char_L() {
    static int32_t pixels[6*7] = {
        0, 0, 0, 0, 0, 0,
        0, 1, 0, 0, 0, 0,
        0, 1, 0, 0, 0, 0,
        0, 1, 0, 0, 0, 0,
        0, 1, 0, 0, 0, 0,
        0, 1, 1, 1, 1, 0,
        0, 0, 0, 0, 0, 0
    };
    struct Character r = { .w = 6, .h = 7, .pixels = pixels };
    return r;
}

struct Character char_l() {
    static int32_t pixels[5*7] = {
        0, 0, 0, 0, 0,
        0, 1, 1, 0, 0,
        0, 0, 1, 0, 0,
        0, 0, 1, 0, 0,
        0, 0, 1, 0, 0,
        0, 0, 1, 1, 0,
        0, 0, 0, 0, 0
    };
    struct Character r = { .w = 5, .h = 7, .pixels = pixels };
    return r;
}

struct Character char_M() {
    static int32_t pixels[7*7] = {
        0, 0, 0, 0, 0, 0, 0,
        0, 1, 0, 0, 0, 1, 0,
        0, 1, 1, 0, 1, 1, 0,
        0, 1, 0, 1, 0, 1, 0,
        0, 1, 0, 0, 0, 1, 0,
        0, 1, 0, 0, 0, 1, 0,
        0, 0, 0, 0, 0, 0, 0
    };
    struct Character r = { .w = 7, .h = 7, .pixels = pixels };
    return r;
}

struct Character char_m() {
    static int32_t pixels[7*6] = {
        0, 0, 0, 0, 0, 0, 0,
        0, 1, 1, 0, 1, 0, 0,
        0, 1, 0, 1, 0, 1, 0,
        0, 1, 0, 1, 0, 1, 0,
        0, 1, 0, 1, 0, 1, 0,
        0, 0, 0, 0, 0, 0, 0
    };
    struct Character r = { .w = 7, .h = 6, .pixels = pixels };
    return r;
}

struct Character char_N() {
    static int32_t pixels[6*7] = {
        0, 0, 0, 0, 0, 0,
        0, 1, 0, 0, 1, 0,
        0, 1, 1, 0, 1, 0,
        0, 1, 0, 1, 1, 0,
        0, 1, 0, 0, 1, 0,
        0, 1, 0, 0, 1, 0,
        0, 0, 0, 0, 0, 0
    };
    struct Character r = { .w = 6, .h = 7, .pixels = pixels };
    return r;
}

struct Character char_n() {
    static int32_t pixels[5*6] = {
        0, 0, 0, 0, 0,
        0, 1, 1, 0, 0,
        0, 1, 0, 1, 0,
        0, 1, 0, 1, 0,
        0, 1, 0, 1, 0,
        0, 0, 0, 0, 0
    };
    struct Character r = { .w = 5, .h = 6, .pixels = pixels };
    return r;
}

struct Character char_O() {
    static int32_t pixels[6*7] = {
        0, 0, 0, 0, 0, 0,
        0, 0, 1, 1, 0, 0,
        0, 1, 0, 0, 1, 0,
        0, 1, 0, 0, 1, 0,
        0, 1, 0, 0, 1, 0,
        0, 0, 1, 1, 0, 0,
        0, 0, 0, 0, 0, 0
    };
    struct Character r = { .w = 6, .h = 7, .pixels = pixels };
    return r;
}

struct Character char_o() {
    static int32_t pixels[6*6] = {
        0, 0, 0, 0, 0, 0,
        0, 0, 1, 1, 0, 0,
        0, 1, 0, 0, 1, 0,
        0, 1, 0, 0, 1, 0,
        0, 0, 1, 1, 0, 0,
        0, 0, 0, 0, 0, 0
    };
    struct Character r = { .w = 6, .h = 6, .pixels = pixels };
    return r;
}

struct Character char_P() {
    static int32_t pixels[6*7] = {
        0, 0, 0, 0, 0, 0,
        0, 1, 1, 1, 0, 0,
        0, 1, 0, 0, 1, 0,
        0, 1, 0, 0, 1, 0,
        0, 1, 1, 1, 0, 0,
        0, 1, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0
    };
    struct Character r = { .w = 6, .h = 7, .pixels = pixels };
    return r;
}

struct Character char_p() {
    static int32_t pixels[5*6] = {
        0, 0, 0, 0, 0,
        0, 1, 1, 1, 0,
        0, 1, 0, 1, 0,
        0, 1, 1, 0, 0,
        0, 1, 0, 0, 0,
        0, 1, 0, 0, 0
    };
    struct Character r = { .w = 5, .h = 6, .pixels = pixels };
    return r;
}

struct Character char_Q() {
    static int32_t pixels[6*7] = {
        0, 0, 0, 0, 0, 0,
        0, 0, 1, 1, 0, 0,
        0, 1, 0, 0, 1, 0,
        0, 1, 0, 0, 1, 0,
        0, 1, 0, 1, 0, 0,
        0, 0, 1, 0, 1, 0,
        0, 0, 0, 0, 0, 0
    };
    struct Character r = { .w = 6, .h = 7, .pixels = pixels };
    return r;
}

struct Character char_q() {
    static int32_t pixels[5*6] = {
        0, 0, 0, 0, 0,
        0, 1, 1, 1, 0,
        0, 1, 0, 1, 0,
        0, 1, 1, 1, 0,
        0, 0, 0, 1, 0,
        0, 0, 0, 1, 0
    };
    struct Character r = { .w = 5, .h = 6, .pixels = pixels };
    return r;
}

struct Character char_R() {
    static int32_t pixels[6*7] = {
        0, 0, 0, 0, 0, 0,
        0, 1, 1, 1, 0, 0,
        0, 1, 0, 0, 1, 0,
        0, 1, 1, 1, 0, 0,
        0, 1, 0, 0, 1, 0,
        0, 1, 0, 0, 1, 0,
        0, 0, 0, 0, 0, 0
    };
    struct Character r = { .w = 6, .h = 7, .pixels = pixels };
    return r;
}

struct Character char_r() {
    static int32_t pixels[5*6] = {
        0, 0, 0, 0, 0,
        0, 1, 0, 1, 0,
        0, 1, 1, 0, 0,
        0, 1, 0, 0, 0,
        0, 1, 0, 0, 0,
        0, 0, 0, 0, 0
    };
    struct Character r = { .w = 5, .h = 6, .pixels = pixels };
    return r;
}

struct Character char_S() {
    static int32_t pixels[6*7] = {
        0, 0, 0, 0, 0, 0,
        0, 0, 1, 1, 1, 0,
        0, 1, 0, 0, 0, 0,
        0, 0, 1, 1, 0, 0,
        0, 0, 0, 0, 1, 0,
        0, 1, 1, 1, 0, 0,
        0, 0, 0, 0, 0, 0
    };
    struct Character r = { .w = 6, .h = 7, .pixels = pixels };
    return r;
}

struct Character char_s() {
    static int32_t pixels[5*6] = {
        0, 0, 0, 0, 0,
        0, 0, 1, 1, 0,
        0, 1, 1, 0, 0,
        0, 0, 1, 1, 0,
        0, 1, 1, 0, 0,
        0, 0, 0, 0, 0
    };
    struct Character r = { .w = 5, .h = 6, .pixels = pixels };
    return r;
}

struct Character char_T() {
    static int32_t pixels[7*7] = {
        0, 0, 0, 0, 0, 0, 0,
        0, 1, 1, 1, 1, 1, 0,
        0, 0, 0, 1, 0, 0, 0,
        0, 0, 0, 1, 0, 0, 0,
        0, 0, 0, 1, 0, 0, 0,
        0, 0, 0, 1, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0,
    };
    struct Character r = { .w = 7, .h = 7, .pixels = pixels };
    return r;
}

struct Character char_t() {
    static int32_t pixels[5*7] = {
        0, 0, 0, 0, 0,
        0, 0, 1, 0, 0,
        0, 1, 1, 1, 0,
        0, 0, 1, 0, 0,
        0, 0, 1, 0, 0,
        0, 0, 0, 1, 0,
        0, 0, 0, 0, 0
    };
    struct Character r = { .w = 5, .h = 7, .pixels = pixels };
    return r;
}

struct Character char_U() {
    static int32_t pixels[6*7] = {
        0, 0, 0, 0, 0, 0,
        0, 1, 0, 0, 1, 0,
        0, 1, 0, 0, 1, 0,
        0, 1, 0, 0, 1, 0,
        0, 1, 0, 0, 1, 0,
        0, 0, 1, 1, 0, 0,
        0, 0, 0, 0, 0, 0
    };
    struct Character r = { .w = 6, .h = 7, .pixels = pixels };
    return r;
}

struct Character char_u() {
    static int32_t pixels[6*6] = {
        0, 0, 0, 0, 0, 0,
        0, 1, 0, 0, 1, 0,
        0, 1, 0, 0, 1, 0,
        0, 1, 0, 0, 1, 0,
        0, 0, 1, 1, 0, 0,
        0, 0, 0, 0, 0, 0
    };
    struct Character r = { .w = 6, .h = 6, .pixels = pixels };
    return r;
}

struct Character char_V() {
    static int32_t pixels[7*7] = {
        0, 0, 0, 0, 0, 0, 0,
        0, 1, 0, 0, 0, 1, 0,
        0, 1, 0, 0, 0, 1, 0,
        0, 0, 1, 0, 1, 0, 0,
        0, 0, 1, 0, 1, 0, 0,
        0, 0, 0, 1, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0
    };
    struct Character r = { .w = 7, .h = 7, .pixels = pixels };
    return r;
}

struct Character char_v() {
    static int32_t pixels[7*6] = {
        0, 0, 0, 0, 0, 0, 0,
        0, 1, 0, 0, 0, 1, 0,
        0, 1, 0, 0, 0, 1, 0,
        0, 0, 1, 0, 1, 0, 0,
        0, 0, 0, 1, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0
    };
    struct Character r = { .w = 7, .h = 6, .pixels = pixels };
    return r;
}

struct Character char_W() {
    static int32_t pixels[7*7] = {
        0, 0, 0, 0, 0, 0, 0,
        0, 1, 0, 1, 0, 1, 0,
        0, 1, 0, 1, 0, 1, 0,
        0, 1, 0, 1, 0, 1, 0,
        0, 0, 1, 0, 1, 0, 0,
        0, 0, 1, 0, 1, 0, 0,
        0, 0, 0, 0, 0, 0, 0
    };
    struct Character r = { .w = 7, .h = 7, .pixels = pixels };
    return r;
}

struct Character char_w() {
    static int32_t pixels[7*6] = {
        0, 0, 0, 0, 0, 0, 0,
        0, 1, 0, 1, 0, 1, 0,
        0, 1, 0, 1, 0, 1, 0,
        0, 1, 0, 1, 0, 1, 0,
        0, 0, 1, 0, 1, 0, 0,
        0, 0, 0, 0, 0, 0, 0
    };
    struct Character r = { .w = 7, .h = 6, .pixels = pixels };
    return r;
}

struct Character char_X() {
    static int32_t pixels[6*7] = {
        0, 0, 0, 0, 0, 0,
        0, 1, 0, 0, 1, 0,
        0, 1, 0, 0, 1, 0,
        0, 0, 1, 1, 0, 0,
        0, 1, 0, 0, 1, 0,
        0, 1, 0, 0, 1, 0,
        0, 0, 0, 0, 0, 0,
    };
    struct Character r = { .w = 6, .h = 7, .pixels = pixels };
    return r;
}

struct Character char_x() {
    static int32_t pixels[7*6] = {
        0, 0, 0, 0, 0, 0, 0,
        0, 1, 1, 0, 1, 1, 0,
        0, 0, 0, 1, 0, 0, 0,
        0, 0, 0, 1, 0, 0, 0,
        0, 1, 1, 0, 1, 1, 0,
        0, 0, 0, 0, 0, 0, 0
    };
    struct Character r = { .w = 7, .h = 6, .pixels = pixels };
    return r;
}

struct Character char_Y() {
    static int32_t pixels[6*7] = {
        0, 0, 0, 0, 0, 0,
        0, 1, 0, 0, 1, 0,
        0, 1, 0, 0, 1, 0,
        0, 0, 1, 1, 1, 0,
        0, 0, 0, 0, 1, 0,
        0, 0, 1, 1, 0, 0,
        0, 0, 0, 0, 0, 0,
    };
    struct Character r = { .w = 6, .h = 7, .pixels = pixels };
    return r;
}

struct Character char_y() {
    static int32_t pixels[6*6] = {
        0, 0, 0, 0, 0, 0,
        0, 1, 0, 0, 1, 0,
        0, 1, 0, 0, 1, 0,
        0, 0, 1, 1, 1, 0,
        0, 0, 0, 0, 1, 0,
        0, 0, 1, 1, 0, 0
    };
    struct Character r = { .w = 6, .h = 6, .pixels = pixels };
    return r;
}

struct Character char_Z() {
    static int32_t pixels[6*7] = {
        0, 0, 0, 0, 0, 0,
        0, 1, 1, 1, 1, 0,
        0, 0, 0, 0, 1, 0,
        0, 0, 1, 1, 0, 0,
        0, 1, 0, 0, 0, 0,
        0, 1, 1, 1, 1, 0,
        0, 0, 0, 0, 0, 0,
    };
    struct Character r = { .w = 6, .h = 7, .pixels = pixels };
    return r;
}

struct Character char_z() {
    static int32_t pixels[5*6] = {
        0, 0, 0, 0, 0,
        0, 1, 1, 1, 0,
        0, 0, 0, 1, 0,
        0, 1, 0, 0, 0,
        0, 1, 1, 1, 0,
        0, 0, 0, 0, 0
    };
    struct Character r = { .w = 5, .h = 6, .pixels = pixels };
    return r;
}

struct Character char_0() {
    static int32_t pixels[6*7] = {
        0, 0, 0, 0, 0, 0,
        0, 0, 1, 1, 0, 0,
        0, 1, 0, 1, 1, 0,
        0, 1, 0, 0, 1, 0,
        0, 1, 1, 0, 1, 0,
        0, 0, 1, 1, 0, 0,
        0, 0, 0, 0, 0, 0
    };
    struct Character r = { .w = 6, .h = 7, .pixels = pixels };
    return r;
}

struct Character char_1() {
    static int32_t pixels[5*7] = {
        0, 0, 0, 0, 0,
        0, 0, 1, 0, 0,
        0, 1, 1, 0, 0,
        0, 0, 1, 0, 0,
        0, 0, 1, 0, 0,
        0, 0, 1, 0, 0,
        0, 0, 0, 0, 0
    };
    struct Character r = { .w = 5, .h = 7, .pixels = pixels };
    return r;
}

struct Character char_2() {
    static int32_t pixels[6*7] = {
        0, 0, 0, 0, 0, 0,
        0, 0, 1, 1, 0, 0,
        0, 1, 0, 0, 1, 0,
        0, 0, 0, 1, 0, 0,
        0, 0, 1, 0, 0, 0,
        0, 1, 1, 1, 1, 0,
        0, 0, 0, 0, 0, 0
    };
    struct Character r = { .w = 6, .h = 7, .pixels = pixels };
    return r;
}

struct Character char_3() {
    static int32_t pixels[6*7] = {
        0, 0, 0, 0, 0, 0,
        0, 1, 1, 1, 0, 0,
        0, 0, 0, 0, 1, 0,
        0, 0, 0, 1, 0, 0,
        0, 0, 0, 0, 1, 0,
        0, 1, 1, 1, 0, 0,
        0, 0, 0, 0, 0, 0
    };
    struct Character r = { .w = 6, .h = 7, .pixels = pixels };
    return r;
}

struct Character char_4() {
    static int32_t pixels[6*7] = {
        0, 0, 0, 0, 0, 0,
        0, 0, 0, 1, 0, 0,
        0, 0, 1, 0, 0, 0,
        0, 1, 0, 0, 1, 0,
        0, 1, 1, 1, 1, 0,
        0, 0, 0, 0, 1, 0,
        0, 0, 0, 0, 0, 0
    };
    struct Character r = { .w = 6, .h = 7, .pixels = pixels };
    return r;
}

struct Character char_5() {
    static int32_t pixels[6*7] = {
        0, 0, 0, 0, 0, 0,
        0, 1, 1, 1, 1, 0,
        0, 1, 0, 0, 0, 0,
        0, 0, 1, 1, 0, 0,
        0, 0, 0, 0, 1, 0,
        0, 1, 1, 1, 0, 0,
        0, 0, 0, 0, 0, 0
    };
    struct Character r = { .w = 6, .h = 7, .pixels = pixels };
    return r;
}

struct Character char_6() {
    static int32_t pixels[6*7] = {
        0, 0, 0, 0, 0, 0,
        0, 0, 1, 1, 0, 0,
        0, 1, 0, 0, 0, 0,
        0, 1, 1, 1, 0, 0,
        0, 1, 0, 0, 1, 0,
        0, 0, 1, 1, 0, 0,
        0, 0, 0, 0, 0, 0
    };
    struct Character r = { .w = 6, .h = 7, .pixels = pixels };
    return r;
}

struct Character char_7() {
    static int32_t pixels[6*7] = {
        0, 0, 0, 0, 0, 0,
        0, 1, 1, 1, 1, 0,
        0, 0, 0, 0, 1, 0,
        0, 0, 0, 1, 0, 0,
        0, 0, 1, 0, 0, 0,
        0, 0, 1, 0, 0, 0,
        0, 0, 0, 0, 0, 0
    };
    struct Character r = { .w = 6, .h = 7, .pixels = pixels };
    return r;
}

struct Character char_8() {
    static int32_t pixels[6*7] = {
        0, 0, 0, 0, 0, 0,
        0, 0, 1, 1, 0, 0,
        0, 1, 0, 0, 1, 0,
        0, 0, 1, 1, 0, 0,
        0, 1, 0, 0, 1, 0,
        0, 0, 1, 1, 0, 0,
        0, 0, 0, 0, 0, 0
    };
    struct Character r = { .w = 6, .h = 7, .pixels = pixels };
    return r;
}

struct Character char_9() {
    static int32_t pixels[6*7] = {
        0, 0, 0, 0, 0, 0,
        0, 0, 1, 1, 0, 0,
        0, 1, 0, 0, 1, 0,
        0, 0, 1, 1, 1, 0,
        0, 0, 0, 0, 1, 0,
        0, 0, 1, 1, 0, 0,
        0, 0, 0, 0, 0, 0
    };
    struct Character r = { .w = 6, .h = 7, .pixels = pixels };
    return r;
}

struct Character char_period() {
    static int32_t pixels[4*7] = {
        0, 0, 0, 0,
        0, 0, 0, 0,
        0, 0, 0, 0,
        0, 0, 0, 0,
        0, 0, 0, 0,
        0, 1, 0, 0,
        0, 0, 0, 0
    };
    struct Character r = { .w = 4, .h = 7, .pixels = pixels };
    return r;
}

struct Character char_comma() {
    static int32_t pixels[5*7] = {
        0, 0, 0, 0, 0,
        0, 0, 0, 0, 0,
        0, 0, 0, 0, 0,
        0, 0, 0, 0, 0,
        0, 0, 0, 0, 0,
        0, 1, 0, 0, 0,
        0, 1, 0, 0, 0
    };
    struct Character r = { .w = 5, .h = 7, .pixels = pixels };
    return r;
}


struct Character char_colon() {
    static int32_t pixels[4*7] = {
        0, 0, 0, 0,
        0, 0, 0, 0,
        0, 0, 0, 0,
        0, 1, 0, 0,
        0, 0, 0, 0,
        0, 1, 0, 0,
        0, 0, 0, 0
    };
    struct Character r = { .w = 4, .h = 7, .pixels = pixels };
    return r;
}

struct Character char_semicolon() {
    static int32_t pixels[4*7] = {
        0, 0, 0, 0,
        0, 0, 0, 0,
        0, 0, 0, 0,
        0, 1, 0, 0,
        0, 0, 0, 0,
        0, 1, 0, 0,
        0, 1, 0, 0
    };
    struct Character r = { .w = 4, .h = 7, .pixels = pixels };
    return r;
}

struct Character char_plus() {
    static int32_t pixels[5*7] = {
        0, 0, 0, 0, 0,
        0, 0, 0, 0, 0,
        0, 0, 1, 0, 0,
        0, 1, 1, 1, 0,
        0, 0, 1, 0, 0,
        0, 0, 0, 0, 0,
        0, 0, 0, 0, 0
    };
    struct Character r = { .w = 5, .h = 7, .pixels = pixels };
    return r;
}

struct Character char_minus() {
    static int32_t pixels[5*7] = {
        0, 0, 0, 0, 0,
        0, 0, 0, 0, 0,
        0, 0, 0, 0, 0,
        0, 1, 1, 1, 0,
        0, 0, 0, 0, 0,
        0, 0, 0, 0, 0,
        0, 0, 0, 0, 0
    };
    struct Character r = { .w = 5, .h = 7, .pixels = pixels };
    return r;
}

struct Character char_equal() {
    static int32_t pixels[5*7] = {
        0, 0, 0, 0, 0,
        0, 0, 0, 0, 0,
        0, 1, 1, 1, 0,
        0, 0, 0, 0, 0,
        0, 1, 1, 1, 0,
        0, 0, 0, 0, 0,
        0, 0, 0, 0, 0
    };
    struct Character r = { .w = 5, .h = 7, .pixels = pixels };
    return r;
}

struct Character char_asterisk() {
    static int32_t pixels[5*7] = {
        0, 0, 0, 0, 0,
        0, 1, 0, 1, 0,
        0, 0, 1, 0, 0,
        0, 1, 0, 1, 0,
        0, 0, 0, 0, 0,
        0, 0, 0, 0, 0,
        0, 0, 0, 0, 0
    };
    struct Character r = { .w = 5, .h = 7, .pixels = pixels };
    return r;
}

struct Character char_slash() {
    static int32_t pixels[5*7] = {
        0, 0, 0, 0, 0,
        0, 0, 0, 1, 0,
        0, 0, 0, 1, 0,
        0, 0, 1, 0, 0,
        0, 0, 1, 0, 0,
        0, 1, 0, 0, 0,
        0, 1, 0, 0, 0
    };
    struct Character r = { .w = 5, .h = 7, .pixels = pixels };
    return r;
}

struct Character char_open_paren() {
    static int32_t pixels[5*7] = {
        0, 0, 0, 1, 0,
        0, 0, 1, 0, 0,
        0, 0, 1, 0, 0,
        0, 0, 1, 0, 0,
        0, 0, 1, 0, 0,
        0, 0, 1, 0, 0,
        0, 0, 0, 1, 0
    };
    struct Character r = { .w = 5, .h = 7, .pixels = pixels };
    return r;
}

struct Character char_close_paren() {
    static int32_t pixels[5*7] = {
        0, 1, 0, 0, 0,
        0, 0, 1, 0, 0,
        0, 0, 1, 0, 0,
        0, 0, 1, 0, 0,
        0, 0, 1, 0, 0,
        0, 0, 1, 0, 0,
        0, 1, 0, 0, 0
    };
    struct Character r = { .w = 5, .h = 7, .pixels = pixels };
    return r;
}

struct Character char_open_bracket() {
    static int32_t pixels[5*7] = {
        0, 0, 1, 1, 0,
        0, 0, 1, 0, 0,
        0, 0, 1, 0, 0,
        0, 0, 1, 0, 0,
        0, 0, 1, 0, 0,
        0, 0, 1, 0, 0,
        0, 0, 1, 1, 0
    };
    struct Character r = { .w = 5, .h = 7, .pixels = pixels };
    return r;
}

struct Character char_close_bracket() {
    static int32_t pixels[5*7] = {
        0, 1, 1, 0, 0,
        0, 0, 1, 0, 0,
        0, 0, 1, 0, 0,
        0, 0, 1, 0, 0,
        0, 0, 1, 0, 0,
        0, 0, 1, 0, 0,
        0, 1, 1, 0, 0
    };
    struct Character r = { .w = 5, .h = 7, .pixels = pixels };
    return r;
}

struct Character char_open_brace() {
    static int32_t pixels[5*7] = {
        0, 0, 0, 1, 0,
        0, 0, 1, 0, 0,
        0, 0, 1, 0, 0,
        0, 1, 0, 0, 0,
        0, 0, 1, 0, 0,
        0, 0, 1, 0, 0,
        0, 0, 0, 1, 0
    };
    struct Character r = { .w = 5, .h = 7, .pixels = pixels };
    return r;
}

struct Character char_close_brace() {
    static int32_t pixels[5*7] = {
        0, 1, 0, 0, 0,
        0, 0, 1, 0, 0,
        0, 0, 1, 0, 0,
        0, 0, 0, 1, 0,
        0, 0, 1, 0, 0,
        0, 0, 1, 0, 0,
        0, 1, 0, 0, 0
    };
    struct Character r = { .w = 5, .h = 7, .pixels = pixels };
    return r;
}

void default_font_create(struct Character symbols[256]) {
    symbols['A'] = char_A();
    symbols['B'] = char_B();
    symbols['C'] = char_C();
    symbols['D'] = char_D();
    symbols['E'] = char_E();
    symbols['F'] = char_F();
    symbols['G'] = char_G();
    symbols['H'] = char_H();
    symbols['I'] = char_I();
    symbols['J'] = char_J();
    symbols['K'] = char_K();
    symbols['L'] = char_L();
    symbols['M'] = char_M();
    symbols['N'] = char_N();
    symbols['O'] = char_O();
    symbols['P'] = char_P();
    symbols['Q'] = char_Q();
    symbols['R'] = char_R();
    symbols['S'] = char_S();
    symbols['T'] = char_T();
    symbols['U'] = char_U();
    symbols['V'] = char_V();
    symbols['W'] = char_W();
    symbols['X'] = char_X();
    symbols['Y'] = char_Y();
    symbols['Z'] = char_Z();

    symbols['a'] = char_a();
    symbols['b'] = char_b();
    symbols['c'] = char_c();
    symbols['d'] = char_d();
    symbols['e'] = char_e();
    symbols['f'] = char_f();
    symbols['g'] = char_g();
    symbols['h'] = char_h();
    symbols['i'] = char_i();
    symbols['j'] = char_j();
    symbols['k'] = char_k();
    symbols['l'] = char_l();
    symbols['m'] = char_m();
    symbols['n'] = char_n();
    symbols['o'] = char_o();
    symbols['p'] = char_p();
    symbols['q'] = char_q();
    symbols['r'] = char_r();
    symbols['s'] = char_s();
    symbols['t'] = char_t();
    symbols['u'] = char_u();
    symbols['v'] = char_v();
    symbols['w'] = char_w();
    symbols['x'] = char_x();
    symbols['y'] = char_y();
    symbols['z'] = char_z();

    symbols['0'] = char_0();
    symbols['1'] = char_1();
    symbols['2'] = char_2();
    symbols['3'] = char_3();
    symbols['4'] = char_4();
    symbols['5'] = char_5();
    symbols['6'] = char_6();
    symbols['7'] = char_7();
    symbols['8'] = char_8();
    symbols['9'] = char_9();

    symbols['.'] = char_period();
    symbols[','] = char_comma();
    symbols[':'] = char_colon();
    symbols[';'] = char_semicolon();

    symbols['+'] = char_plus();
    symbols['-'] = char_minus();
    symbols['*'] = char_asterisk();
    symbols['/'] = char_slash();
    symbols['='] = char_equal();

    symbols['('] = char_open_paren();
    symbols[')'] = char_close_paren();
    symbols['['] = char_open_bracket();
    symbols[']'] = char_close_bracket();
    symbols['{'] = char_open_brace();
    symbols['}'] = char_close_brace();
}