<commit_before>package net.squanchy.typeface

import android.graphics.Paint
import android.graphics.Typeface
import net.squanchy.extensions.whenTrue

class TypefaceDelegate(private val newTypeface: Typeface) {

    private companion object {
        @SuppressWarnings("MagicNumber")
        const val TEXT_SKEW_X = -.25f
        const val FALSE_FLAG = 0
    }


    fun applyStyleTo(paint: Paint) {
        val fakeStyle = fakeStyle(paint)
        bold(fakeStyle).whenTrue { paint.isFakeBoldText = true }
        italic(fakeStyle).whenTrue { paint.textSkewX = TEXT_SKEW_X }

        paint.typeface = newTypeface
    }

    private fun bold(fakeStyle: Int) = fakeStyle.and(Typeface.BOLD) != FALSE_FLAG

    private fun italic(fakeStyle: Int) = fakeStyle.and(Typeface.ITALIC) != FALSE_FLAG

    private fun fakeStyle(paint: Paint) : Int {
        val oldStyle = paint.typeface?.style ?:0
        return oldStyle.and(newTypeface.style.inv())
    }
}<commit_msg>Fix empty line on TypefaceDelegate<commit_after>package net.squanchy.typeface

import android.graphics.Paint
import android.graphics.Typeface
import net.squanchy.extensions.whenTrue

class TypefaceDelegate(private val newTypeface: Typeface) {

    private companion object {
        @SuppressWarnings("MagicNumber")
        const val TEXT_SKEW_X = -.25f
        const val FALSE_FLAG = 0
    }

    fun applyStyleTo(paint: Paint) {
        val fakeStyle = fakeStyle(paint)
        bold(fakeStyle).whenTrue { paint.isFakeBoldText = true }
        italic(fakeStyle).whenTrue { paint.textSkewX = TEXT_SKEW_X }

        paint.typeface = newTypeface
    }

    private fun bold(fakeStyle: Int) = fakeStyle.and(Typeface.BOLD) != FALSE_FLAG

    private fun italic(fakeStyle: Int) = fakeStyle.and(Typeface.ITALIC) != FALSE_FLAG

    private fun fakeStyle(paint: Paint) : Int {
        val oldStyle = paint.typeface?.style ?:0
        return oldStyle.and(newTypeface.style.inv())
    }
}
{'fraction_non_alphanumeric': 0.09400826446280992, 'fraction_numerical': 0.004132231404958678, 'mean_word_length': 3.3044444444444445, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, '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': '3017270', 'n_tokens_mistral': 628, 'n_tokens_neox': 601, 'n_words': 128}