<commit_before>/*******************************************************************************
 * Copyright 2011 See AUTHORS file.
 * 
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 *   http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 ******************************************************************************/

package com.badlogic.gdx.tools.bmfont;

import com.badlogic.gdx.files.FileHandle;
import com.badlogic.gdx.graphics.Pixmap;
import com.badlogic.gdx.graphics.PixmapIO;
import com.badlogic.gdx.graphics.g2d.BitmapFont.BitmapFontData;
import com.badlogic.gdx.graphics.g2d.BitmapFont.Glyph;
import com.badlogic.gdx.graphics.g2d.PixmapPacker.Page;
import com.badlogic.gdx.tools.hiero.Hiero;
import com.badlogic.gdx.utils.Array;

/** A utility to output BitmapFontData to a FNT file. This can be useful for caching the result from TrueTypeFont, for faster load
 * times.
 * <p>
 * The font file format is from the AngelCodeFont BMFont tool.
 * <p>
 * Output is nearly identical to the FreeType settting in the {@link Hiero} tool. BitmapFontWriter gives more flexibility, eg
 * borders and shadows can be used. Hiero is able to avoid outputting the same glyph image more than once if multiple character
 * codes have the exact same glyph.
 * @author mattdesl AKA davedes */
public class BitmapFontWriter {

	/** The output format. */
	public static enum OutputFormat {

		/** AngelCodeFont text format */
		Text,
		/** AngelCodeFont XML format */
		XML;
	}

	/** The output format */
	private static OutputFormat format = OutputFormat.Text;
<commit_msg>Fixed BitmapFontWriter not working on Android (and possibly others) (#5333)<commit_after>/*******************************************************************************
 * Copyright 2011 See AUTHORS file.
 * 
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 *   http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 ******************************************************************************/

package com.badlogic.gdx.tools.bmfont;

import com.badlogic.gdx.files.FileHandle;
import com.badlogic.gdx.graphics.Pixmap;
import com.badlogic.gdx.graphics.PixmapIO;
import com.badlogic.gdx.graphics.g2d.BitmapFont.BitmapFontData;
import com.badlogic.gdx.graphics.g2d.BitmapFont.Glyph;
import com.badlogic.gdx.graphics.g2d.PixmapPacker.Page;
import com.badlogic.gdx.utils.Array;

/** A utility to output BitmapFontData to a FNT file. This can be useful for caching the result from TrueTypeFont, for faster load
 * times.
 * <p>
 * The font file format is from the AngelCodeFont BMFont tool.
 * <p>
 * Output is nearly identical to the FreeType settting in the Hiero tool {@Link com.badlogic.gdx.tools.hiero.Hiero}. BitmapFontWriter gives more flexibility, eg
 * borders and shadows can be used. Hiero is able to avoid outputting the same glyph image more than once if multiple character
 * codes have the exact same glyph.
 * @author mattdesl AKA davedes */
public class BitmapFontWriter {

	/** The output format. */
	public static enum OutputFormat {

		/** AngelCodeFont text format */
		Text,
		/** AngelCodeFont XML format */
		XML;
	}

	/** The output format */
	private static OutputFormat format = OutputFormat.Text;

{'fraction_non_alphanumeric': 0.15264187866927592, 'fraction_numerical': 0.006360078277886497, 'mean_word_length': 4.44474034620506, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '4743008', 'n_tokens_mistral': 1163, 'n_tokens_neox': 1075, 'n_words': 434}