<commit_before>/*
 * THE NEW CHRONOTEXT TOOLKIT: https://github.com/arielm/new-chronotext-toolkit
 * COPYRIGHT (C) 2012, <NAME> ALL RIGHTS RESERVED.
 *
 * THE FOLLOWING SOURCE-CODE IS DISTRIBUTED UNDER THE MODIFIED BSD LICENSE:
 * https://github.com/arielm/new-chronotext-toolkit/blob/master/LICENSE.md
 */

#pragma once

#include "chronotext/font/FontMatrix.h"
#include "chronotext/font/xf/FontSequence.h"

#include "cinder/gl/gl.h"

#include <map>

namespace chronotext
{
    typedef class xf::Font XFont;

    namespace xf
    {
        class FontManager;
        struct FontData;
        struct FontTexture;
        
        class Font
        {
        public:
            typedef enum
            {
                ALIGN_MIDDLE,
                ALIGN_LEFT,
                ALIGN_RIGHT,
                ALIGN_TOP,
                ALIGN_BASELINE,
                ALIGN_BOTTOM
            }
            Alignment;
            
            struct Properties
            {
                bool useAnisotropy;
                int slotCapacity;
                
                Properties(bool useAnisotropy, int slotCapacity)
                :
                useAnisotropy(useAnisotropy),
                slotCapacity(slotCapacity)
                {}
                
                Properties&	capacity(float slotCapacity)
				{
                    this->slotCapacity = slotCapacity;
                    return *this;
                }
                
                bool operator<(const Properties &rhs) const
                {
                    return std::tie(useAnisotropy, slotCapacity) < std::tie(rhs.useAnisotropy, rhs.slotCapacity);
                }
            };
            
            static Properties Properties2d()
            {
                return Properties(false, 1024);
            }
            
            static Properties Properties3d()
            {
                return Properties(true, 4096);
            }
            
            bool isSpace(wchar_t c) const;
            bool isValid(wchar_t c) const;
            int getGlyphIndex(wchar_t c) const;
            std::wstring getCharacters() const;
            
            void setSize(float size);
            void setDirection(float direction);
            void setAxis(const ci::Vec2f &axis);
            void setColor(const ci::ColorA &color);
            void setColor(float r, float g, float b, float a);
            void setStrikethroughFactor(float factor);
            
            void setClip(const ci::Rectf &clipRect);
            void setClip(float x1, float y1, float x2, float y2);
            void clearClip();
            
            float getSize() const;
            float getDirection() const;
            const ci::Vec2f& getAxis() const;
            
            float getGlyphAdvance(int glyphIndex) const;
            float getCharAdvance(wchar_t c) const;
            float getStringAdvance(const std::wstring &s) const;
            float getSubStringAdvance(const std::wstring &s, int begin, int end) const;
            
            float getHeight() const;
            float getAscent() const;
            float getDescent() const;
            float getStrikethroughOffset() const;
            float getUnderlineOffset() const;
            float getLineThickness() const;<commit_msg>INLINING...<commit_after>/*
 * THE NEW CHRONOTEXT TOOLKIT: https://github.com/arielm/new-chronotext-toolkit
 * COPYRIGHT (C) 2012, <NAME> ALL RIGHTS RESERVED.
 *
 * THE FOLLOWING SOURCE-CODE IS DISTRIBUTED UNDER THE MODIFIED BSD LICENSE:
 * https://github.com/arielm/new-chronotext-toolkit/blob/master/LICENSE.md
 */

#pragma once

#include "chronotext/font/FontMatrix.h"
#include "chronotext/font/xf/FontSequence.h"

#include "cinder/gl/gl.h"

#include <map>

namespace chronotext
{
    typedef class xf::Font XFont;

    namespace xf
    {
        class FontManager;
        struct FontData;
        struct FontTexture;
        
        class Font
        {
        public:
            typedef enum
            {
                ALIGN_MIDDLE,
                ALIGN_LEFT,
                ALIGN_RIGHT,
                ALIGN_TOP,
                ALIGN_BASELINE,
                ALIGN_BOTTOM
            }
            Alignment;
            
            struct Properties
            {
                bool useAnisotropy;
                int slotCapacity;
                
                Properties(bool useAnisotropy, int slotCapacity)
                :
                useAnisotropy(useAnisotropy),
                slotCapacity(slotCapacity)
                {}
                
                Properties&	capacity(float slotCapacity)
				{
                    this->slotCapacity = slotCapacity;
                    return *this;
                }
                
                bool operator<(const Properties &rhs) const
                {
                    return std::tie(useAnisotropy, slotCapacity) < std::tie(rhs.useAnisotropy, rhs.slotCapacity);
                }
            };
            
            static Properties Properties2d()
            {
                return Properties(false, 1024);
            }
            
            static Properties Properties3d()
            {
                return Properties(true, 4096);
            }
            
            bool isSpace(wchar_t c) const;
            bool isValid(wchar_t c) const;
            int getGlyphIndex(wchar_t c) const;
            std::wstring getCharacters() const;
            
            void setSize(float size);
            void setDirection(float direction);
            void setAxis(const ci::Vec2f &axis);
            inline void setAxis(float x, float y) { setAxis(ci::Vec2f(x, y)); }
            void setColor(const ci::ColorA &color);
            void setColor(float r, float g, float b, float a);
            void setStrikethroughFactor(float factor);
            
            void setClip(const ci::Rectf &clipRect);
            void setClip(float x1, float y1, float x2, float y2);
            void clearClip();
            
            float getSize() const;
            float getDirection() const;
            const ci::Vec2f& getAxis() const;
            
            float getGlyphAdvance(int glyphIndex) const;
            float getCharAdvance(wchar_t c) const;
            float getStringAdvance(const std::wstring &s) const;
            float getSubStringAdvance(const std::wstring &s, int begin, int end) const;
            
            float getHeight() const;
            float getAscent() const;
            float getDescent() const;
            float getStrikethroughOffset() const;
            float getUnderlineOffset() const;
            float getLineThickness() const;
{'fraction_non_alphanumeric': 0.07740585774058577, 'fraction_numerical': 0.006126718469814704, 'mean_word_length': 1.425, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 9, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3077049', 'n_tokens_mistral': 1838, 'n_tokens_neox': 1734, 'n_words': 421}