package speiger.src.coreengine.ui.gui.font;

import java.util.List;

import speiger.src.coreengine.assets.api.ID;
import speiger.src.coreengine.ui.gui.font.glyth.UnbakedGlyth;
import speiger.src.coreengine.ui.gui.font.providers.IFontProvider;

public class FontGroup {
	ID locations;
	List<IFontProvider> providers;
	
	public FontGroup(ID locations, List<IFontProvider> providers) {
		this.locations = locations;
		this.providers = providers;
	}
		
	public UnbakedGlyth data(int codepoint, int style, float size, float oversample) {
		for(int i = 0,m=providers.size();i<m;i++) {
			UnbakedGlyth data = providers.get(i).glythData(codepoint, style, size, oversample);
			if(data != null) return data;
		}
		return null;
	}
	
	public void close() {
		providers.forEach(IFontProvider::close);
		providers.clear();
	}
}