WELCOME TO INFOCHEATS.NET

INFOCHEATS is a community-driven platform focused on free game cheats, cheat development, and verified commercial software for a wide range of popular games. We provide a large collection of free cheats shared by the community. All public releases are checked for malicious code to reduce the risk of viruses, malware, or unwanted software before users interact with them.

Alongside free content, INFOCHEATS hosts an active marketplace with many independent sellers offering commercial cheats. Each product is discussed openly, with user feedback, reviews, and real usage experience available to help you make informed decisions before purchasing.

Whether you are looking for free cheats, exploring paid solutions, comparing sellers, or studying how cheats are developed and tested, INFOCHEATS brings everything together in one place — transparently and community-driven.

Font To Byte

Eirene

Newbie
Newbie

Eirene

Newbie
Newbie
Status
Offline
Joined
Jun 14, 2019
Messages
2
Reaction score
0
Hi Guys


How do I convert a font to bytes and add it to the menu buttons?
 

DREDD

Administrator
Administrator

DREDD

Administrator
Administrator
Status
Offline
Joined
Apr 18, 2019
Messages
147
Reaction score
249
Hi Guys


How do I convert a font to bytes and add it to the menu buttons?
Code:
#include <iostream>
#include <sstream>
#include <Windows.h>
#include <fstream>
#include <iomanip>
#include <cctype>
#include <experimental/filesystem>

namespace fs = std::experimental::filesystem;

bool GenerateCode(std::string file)
{
    const fs::path FilePath = file;
    std::ifstream GenerateFile(FilePath, std::ios::binary);
    if (GenerateFile.fail()) {
        std::cout << "Could not open file!" << std::endl;
        return false;
    }
    std::cout << "Open file: " << FilePath << "\n" << std::endl;

    GenerateFile.seekg(0, std::ios_base::end);
    size_t sizeFile = GenerateFile.tellg();
    std::cout << "Size: " << sizeFile << std::endl;
    GenerateFile.seekg(0, GenerateFile.beg);

    std::string szNameFile = FilePath.stem().string();
    std::string szOutFile = szNameFile.append(".h");
    std::cout << "Out File: " << szOutFile << std::endl;

    std::ofstream StreamOut(szOutFile, std::ios::trunc);
    if (StreamOut.fail()) {
        std::cout << "Could not create file!" << std::endl;
        return false;
    }

    std::string szNameArarry = FilePath.stem().string();
    szNameArarry.erase(std::remove_if(szNameArarry.begin(), szNameArarry.end(),
        [](auto const& c) -> bool
    {
        return !std::isalnum(c);
    }),
        szNameArarry.end());

    StreamOut << "//GenerateCode by  Kraysler, 2018\n\n//File size: " << sizeFile << std::endl;
    StreamOut << "unsigned char " << szNameArarry << "[] =" << std::endl;
    StreamOut << "{" << std::endl;
    StreamOut << "\t";

    std::stringstream ss;
    ss << std::hex << std::uppercase << std::setfill('0');
    const char* separator = "";
    int col = 0;

    auto it = std::istreambuf_iterator<char>(GenerateFile);
    auto eof = std::istreambuf_iterator<char>();
    while (!it.equal(eof)) {
        unsigned int c = *it++ & 0xFF;
        ss << separator << "0x" << std::setw(2) << c;
        separator = ", ";
        if (++col % 16 == 0) {
            if (it != eof) {
                ss << "," << std::endl;
                ss << "\t";
                separator = "";
            }
        }
    }

    StreamOut << ss.str();
    StreamOut << std::endl;
    StreamOut << "};" << std::endl;

    GenerateFile.close();
    StreamOut.close();
}
call this

Code:
ImFontConfig config;
    config.MergeMode = true;
    static const ImWchar icon_ranges[] = { ICON_MIN_FA, ICON_MAX_FA, 0 };
    this->AwesomeFont = io.Fonts->AddFontFromMemoryTTF((void*)AwesomeArry, sizeof(AwesomeArry), 20.0f, &config, icon_ranges);
at the output we get
Code:
io.Fonts->AddFontFromMemoryTTF((void*)FontArry, sizeof(FontArry), fSizeFont);
 

Eirene

Newbie
Newbie

Eirene

Newbie
Newbie
Status
Offline
Joined
Jun 14, 2019
Messages
2
Reaction score
0
Code:
#include <iostream>
#include <sstream>
#include <Windows.h>
#include <fstream>
#include <iomanip>
#include <cctype>
#include <experimental/filesystem>

namespace fs = std::experimental::filesystem;

bool GenerateCode(std::string file)
{
    const fs::path FilePath = file;
    std::ifstream GenerateFile(FilePath, std::ios::binary);
    if (GenerateFile.fail()) {
        std::cout << "Could not open file!" << std::endl;
        return false;
    }
    std::cout << "Open file: " << FilePath << "\n" << std::endl;

    GenerateFile.seekg(0, std::ios_base::end);
    size_t sizeFile = GenerateFile.tellg();
    std::cout << "Size: " << sizeFile << std::endl;
    GenerateFile.seekg(0, GenerateFile.beg);

    std::string szNameFile = FilePath.stem().string();
    std::string szOutFile = szNameFile.append(".h");
    std::cout << "Out File: " << szOutFile << std::endl;

    std::ofstream StreamOut(szOutFile, std::ios::trunc);
    if (StreamOut.fail()) {
        std::cout << "Could not create file!" << std::endl;
        return false;
    }

    std::string szNameArarry = FilePath.stem().string();
    szNameArarry.erase(std::remove_if(szNameArarry.begin(), szNameArarry.end(),
        [](auto const& c) -> bool
    {
        return !std::isalnum(c);
    }),
        szNameArarry.end());

    StreamOut << "//GenerateCode by  Kraysler, 2018\n\n//File size: " << sizeFile << std::endl;
    StreamOut << "unsigned char " << szNameArarry << "[] =" << std::endl;
    StreamOut << "{" << std::endl;
    StreamOut << "\t";

    std::stringstream ss;
    ss << std::hex << std::uppercase << std::setfill('0');
    const char* separator = "";
    int col = 0;

    auto it = std::istreambuf_iterator<char>(GenerateFile);
    auto eof = std::istreambuf_iterator<char>();
    while (!it.equal(eof)) {
        unsigned int c = *it++ & 0xFF;
        ss << separator << "0x" << std::setw(2) << c;
        separator = ", ";
        if (++col % 16 == 0) {
            if (it != eof) {
                ss << "," << std::endl;
                ss << "\t";
                separator = "";
            }
        }
    }

    StreamOut << ss.str();
    StreamOut << std::endl;
    StreamOut << "};" << std::endl;

    GenerateFile.close();
    StreamOut.close();
}
call this

Code:
ImFontConfig config;
    config.MergeMode = true;
    static const ImWchar icon_ranges[] = { ICON_MIN_FA, ICON_MAX_FA, 0 };
    this->AwesomeFont = io.Fonts->AddFontFromMemoryTTF((void*)AwesomeArry, sizeof(AwesomeArry), 20.0f, &config, icon_ranges);
at the output we get
Code:
io.Fonts->AddFontFromMemoryTTF((void*)FontArry, sizeof(FontArry), fSizeFont);

Thanks for help ❤
 
Top