Example usage for android.graphics Typeface createFromAsset

List of usage examples for android.graphics Typeface createFromAsset

Introduction

In this page you can find the example usage for android.graphics Typeface createFromAsset.

Prototype

public static Typeface createFromAsset(AssetManager mgr, String path) 

Source Link

Document

Create a new typeface from the specified font data.

Usage

From source file:gr.sepals.eshop.info.gui.BalconySlidePageFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    ViewGroup rootView = (ViewGroup) inflater.inflate(R.layout.fragment_info_balcony, container, false);
    title = (TextView) rootView.findViewById(R.id.info_balcony_title_textview);
    desc = (TextView) rootView.findViewById(R.id.info_balcony_description_textview);
    Typeface titleFont = Typeface.createFromAsset(getActivity().getAssets(), "fonts/GFS_Pyrsos.otf");
    Typeface descFont = Typeface.createFromAsset(getActivity().getAssets(), "fonts/GFS_Goschen-Italic.otf");
    title.setTypeface(titleFont, Typeface.BOLD);
    desc.setTypeface(descFont);/*from   w  ww  .j av a  2  s .  co  m*/
    return rootView;
}

From source file:gr.sepals.eshop.info.gui.NetworkSlidePageFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    ViewGroup rootView = (ViewGroup) inflater.inflate(R.layout.fragment_info_network, container, false);
    title = (TextView) rootView.findViewById(R.id.info_network_title_textview);
    desc = (TextView) rootView.findViewById(R.id.info_network_description_textview);
    Typeface titleFont = Typeface.createFromAsset(getActivity().getAssets(), "fonts/GFS_Pyrsos.otf");
    Typeface descFont = Typeface.createFromAsset(getActivity().getAssets(), "fonts/GFS_Goschen-Italic.otf");
    title.setTypeface(titleFont, Typeface.BOLD);
    desc.setTypeface(descFont);//from w w w  .  j ava  2  s . c o m
    return rootView;
}

From source file:gr.sepals.eshop.info.gui.ProductsSlidePageFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    ViewGroup rootView = (ViewGroup) inflater.inflate(R.layout.fragment_info_products, container, false);
    title = (TextView) rootView.findViewById(R.id.info_products_title_textview);
    desc = (TextView) rootView.findViewById(R.id.info_products_description_textview);
    Typeface titleFont = Typeface.createFromAsset(getActivity().getAssets(), "fonts/GFS_Pyrsos.otf");
    Typeface descFont = Typeface.createFromAsset(getActivity().getAssets(), "fonts/GFS_Goschen-Italic.otf");
    title.setTypeface(titleFont, Typeface.BOLD);
    desc.setTypeface(descFont);/*w w  w  .ja  va2 s  . c  om*/
    return rootView;
}

From source file:com.bytestemplar.tonedef.international.InternationalActivity.java

/******************************************************************/
@Override//from w ww  . j  a  v a 2s  .  c  om
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    this._ttf_dxb = Typeface.createFromAsset(this.getAssets(), UICustom.TYPEFACE_FILENAME);

    setContentView(R.layout.international);

    //Log.d( "BT", "OnCreate ---" );

    _is_dual_pane = true;

    // Single view UI
    if (findViewById(R.id.frag_single_container) != null) {
        _is_dual_pane = false;

        CountryListFragment frag;

        frag = new CountryListFragment();

        frag.setArguments(getIntent().getExtras());

        getSupportFragmentManager().beginTransaction().replace(R.id.frag_single_container, frag, COUNTRY_TAG)
                .commit();
    }
}

From source file:Main.java

public static Typeface getTypeface33(Context context) {

    if (appTypeface33 == null) {
        appTypeface33 = Typeface.createFromAsset(context.getAssets(), "fonts/en33.otf");
    }/*  w  w  w.  j  a  v a  2  s  .c  om*/
    return appTypeface33;
}

From source file:com.example.prox.model.TypefaceSpan.java

/**
 * Load the {@link Typeface} and apply to a {@link Spannable}.
 *///  w ww. jav  a 2  s .c o m
public TypefaceSpan(Context context, String typefaceName) {
    mTypeface = sTypefaceCache.get(typefaceName);

    if (mTypeface == null) {
        mTypeface = Typeface.createFromAsset(context.getApplicationContext().getAssets(), "fonts/Maiandra.ttf");

        // Cache the loaded Typeface
        sTypefaceCache.put(typefaceName, mTypeface);
    }
}

From source file:com.mindgames.dailylaw.external.TypeFaceSpan.java

/**
 * Load the {@link Typeface} and apply to a {@link android.text.Spannable}.
 *//*from   w  w w . j  av a  2  s .  c o  m*/
public TypeFaceSpan(Context context, String typefaceName) {
    mTypeface = sTypefaceCache.get(typefaceName);

    if (mTypeface == null) {
        mTypeface = Typeface.createFromAsset(context.getApplicationContext().getAssets(),
                String.format("fonts/%s", typefaceName));

        // Cache the loaded Typeface
        sTypefaceCache.put(typefaceName, mTypeface);
    }
}

From source file:Main.java

/**
 * Sets a determined font on a text view element
 *
 * @param context Context in which the TextView can be found
 * @param font    Font to be set in the text view see available fonts as static attributes of this class
 * @param style   {@see Typeface}//from  w  ww  .  j  a  va 2  s  .co  m
 * @param buttons Buttons to which the font will be applied
 */
public static void setTypeface(Context context, String font, int style, Button... buttons) {
    Typeface tf = Typeface.createFromAsset(context.getAssets(), font);
    for (Button txt : buttons) {
        txt.setTypeface(tf, style);
    }
}

From source file:com.alixander.nutrihawk.TypeSpan.java

/**
 * Load the {@link Typeface} and apply to a {@link Spannable}.
 *//* w w w.  j a  v a 2s. co m*/
public TypeSpan(Context context, String typefaceName) {
    mTypeface = sTypefaceCache.get(typefaceName);

    if (mTypeface == null) {
        mTypeface = Typeface.createFromAsset(context.getApplicationContext().getAssets(),
                String.format("fonts/%s", typefaceName));

        // Cache the loaded Typeface
        sTypefaceCache.put(typefaceName, mTypeface);
    }
}

From source file:gr.sepals.eshop.info.gui.ThanksSlidePageFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    ViewGroup rootView = (ViewGroup) inflater.inflate(R.layout.fragment_info_thanks, container, false);

    title = (TextView) rootView.findViewById(R.id.info_thanks_title_textview);
    Typeface titleFont = Typeface.createFromAsset(getActivity().getAssets(), "fonts/GFS_Pyrsos.otf");
    title.setTypeface(titleFont, Typeface.BOLD);

    CheckBox hideInfo = (CheckBox) rootView.findViewById(R.id.hide_info_checkBox);
    Typeface descFont = Typeface.createFromAsset(getActivity().getAssets(), "fonts/GFS_Goschen-Italic.otf");
    hideInfo.setTypeface(descFont);//from   w  w  w  .ja  v a2s . com
    hideInfo.setOnCheckedChangeListener(this);

    // update the fragment content
    hideInfo.setChecked(Settings.getBoolean(getActivity(), InternalDatabaseKeys.HIDE_INTRO_INFO, false));
    return rootView;
}