Details

      Description

      {html}<div><p><em>Feature Request</em></p>
      <p>Support for Custom Fonts on Android Devices.</p></div>{html}

        Activity

        Hide
        Don Thorp added a comment -
        {html}<div><p>Needs to go on 1.6.2 as well.</p></div>{html}
        Show
        Don Thorp added a comment - {html}<div><p>Needs to go on 1.6.2 as well.</p></div>{html}
        Hide
        Bill Dawson added a comment -
        {html}<div><p>(from <a href=
        "/projects/32238/changesets/d06a815b13625e60d5f43f717420af9ab2308db6"
        title=
        "Changeset [d06a815b13625e60d5f43f717420af9ab2308db6]">[d06a815b13625e60d5f43f717420af9ab2308db6]</a>)
        Support custom fonts loaded in assets/fonts. [<a href=
        "/projects/32238/tickets/3418" title="Ticket #3418">#3418</a>]
        <a href=
        "https://github.com/appcelerator/titanium_mobile/commit/d06a815b13625e60d5f43f717420af9ab2308db6">
        https://github.com/appcelerator/titanium_mobile/commit/d06a815b1362...</a></p></div>{html}
        Show
        Bill Dawson added a comment - {html}<div><p>(from <a href= "/projects/32238/changesets/d06a815b13625e60d5f43f717420af9ab2308db6" title= "Changeset [d06a815b13625e60d5f43f717420af9ab2308db6] "> [d06a815b13625e60d5f43f717420af9ab2308db6] </a>) Support custom fonts loaded in assets/fonts. [<a href= "/projects/32238/tickets/3418" title="Ticket #3418">#3418</a>] <a href= "https://github.com/appcelerator/titanium_mobile/commit/d06a815b13625e60d5f43f717420af9ab2308db6"> https://github.com/appcelerator/titanium_mobile/commit/d06a815b1362 ...</a></p></div>{html}
        Hide
        Bill Dawson added a comment -
        {html}<div><p>(from <a href=
        "/projects/32238/changesets/89670092e070d0c67f04300becd3b18285b3753a"
        title=
        "Changeset [89670092e070d0c67f04300becd3b18285b3753a]">[89670092e070d0c67f04300becd3b18285b3753a]</a>)
        Move the default font file location to Resources/fonts so as to
        take advantage of our built-in builder.py file
        delta/deletion/addition checking. [<a href=
        "/projects/32238/tickets/3418" title="Ticket #3418">#3418</a>]
        <a href=
        "https://github.com/appcelerator/titanium_mobile/commit/89670092e070d0c67f04300becd3b18285b3753a">
        https://github.com/appcelerator/titanium_mobile/commit/89670092e070...</a></p></div>{html}
        Show
        Bill Dawson added a comment - {html}<div><p>(from <a href= "/projects/32238/changesets/89670092e070d0c67f04300becd3b18285b3753a" title= "Changeset [89670092e070d0c67f04300becd3b18285b3753a] "> [89670092e070d0c67f04300becd3b18285b3753a] </a>) Move the default font file location to Resources/fonts so as to take advantage of our built-in builder.py file delta/deletion/addition checking. [<a href= "/projects/32238/tickets/3418" title="Ticket #3418">#3418</a>] <a href= "https://github.com/appcelerator/titanium_mobile/commit/89670092e070d0c67f04300becd3b18285b3753a"> https://github.com/appcelerator/titanium_mobile/commit/89670092e070 ...</a></p></div>{html}
        Hide
        Bill Dawson added a comment -
        {html}<div><p>To use this, put your custom (third-party) font files in
        <code>Resources/fonts</code> (or
        <code>Resources/android/fonts</code> if you prefer ... both will be
        handled). Then when setting the <code>font</code> property of the
        view (Label, TextField, etc.), set the <code>fontFamily</code>
        member to the base filename of the font file (i.e., the file name
        without the extension).</p>
        <p><strong>EXAMPLE</strong> (to be used for QE testing as
        well):</p>
        <ul>
        <li>
        <p>Create a new project.</p>
        </li>
        <li>
        <p>Create the <code>Resources/fonts</code> folder in that
        project.</p>
        </li>
        <li>
        <p>Download and unzip the attached Chantelli-Antiqua.zip file, and
        copy Chantelli-Antiqua.ttf into your <code>Resources/fonts</code>
        folder.</p>
        </li>
        <li>
        <p>Use this as your app.js:</p>
        </li>
        </ul>
        <pre>
        <code class="javascript">Titanium.UI.setBackgroundColor('#000');
        var win = Titanium.UI.createWindow({ title:'Test', backgroundColor:'#000', exitOnClose: true, layout: 'vertical' });

        var lbl = Ti.UI.createLabel({
        text: "Now is the time for all good men to come to the aid of their country",
        font: {fontFamily: 'chantelli_antiqua', fontSize: '15dp'},
        height: 'auto',
        width: 'auto',
        top:10,
        backgroundColor: 'red',
        color: 'white'
        });
        win.add(lbl);

        var tf = Ti.UI.createTextField({
        hintText: "Type here",
        font: {fontFamily: 'Chantelli_antiqua', fontSize: '15dp'},
        height: 'auto', width: '100%',
        top: 10
        });
        win.add(tf);

        var ta = Ti.UI.createTextArea({
        hintText: "Type here, mein Freund",
        font: {fontFamily: 'Chantelli_antiqua', fontSize: '15dp'},
        height: '80dp', width: '100%', borderRadius: '5',
        top: 10
        });
        win.add(ta);

        var btn = Ti.UI.createButton({
        font: {fontFamily: 'Chantelli_antiqua', fontSize: '15dp'},
        title: 'I am a button',
        height: 'auto', width: 'auto',
        top: 10
        });
        win.add(btn);

        var btn2 = Ti.UI.createButton({
        font: {fontFamily: 'Chantelli_antiqua', fontSize: '15dp', fontWeight: 'bold'},
        title: 'I am also a button',
        height: 'auto', width: 'auto',
        top: 10
        });
        win.add(btn2);

        var btn3 = Ti.UI.createButton({
        font: {fontFamily: 'Chantelli_antiqua', fontSize: '25dp', fontWeight: 'bold'},
        title: 'Ah, but so am I a button',
        height: 'auto', width: 'auto',
        top: 10
        });
        win.add(btn3);

        win.open();</code>
        </pre>
        <p>Notice in several places we're setting <code>font: {fontFamily: 'Chantelli_antiqua' ... }</code>. (Case doesn't matter.)</p>
        <p>When you run it, you will (or should) notice that the font is
        not a standard font. See attached screenshot.png.</p></div>{html}
        Show
        Bill Dawson added a comment - {html}<div><p>To use this, put your custom (third-party) font files in <code>Resources/fonts</code> (or <code>Resources/android/fonts</code> if you prefer ... both will be handled). Then when setting the <code>font</code> property of the view (Label, TextField, etc.), set the <code>fontFamily</code> member to the base filename of the font file (i.e., the file name without the extension).</p> <p><strong>EXAMPLE</strong> (to be used for QE testing as well):</p> <ul> <li> <p>Create a new project.</p> </li> <li> <p>Create the <code>Resources/fonts</code> folder in that project.</p> </li> <li> <p>Download and unzip the attached Chantelli-Antiqua.zip file, and copy Chantelli-Antiqua.ttf into your <code>Resources/fonts</code> folder.</p> </li> <li> <p>Use this as your app.js:</p> </li> </ul> <pre> <code class="javascript">Titanium.UI.setBackgroundColor('#000'); var win = Titanium.UI.createWindow({ title:'Test', backgroundColor:'#000', exitOnClose: true, layout: 'vertical' }); var lbl = Ti.UI.createLabel({ text: "Now is the time for all good men to come to the aid of their country", font: {fontFamily: 'chantelli_antiqua', fontSize: '15dp'}, height: 'auto', width: 'auto', top:10, backgroundColor: 'red', color: 'white' }); win.add(lbl); var tf = Ti.UI.createTextField({ hintText: "Type here", font: {fontFamily: 'Chantelli_antiqua', fontSize: '15dp'}, height: 'auto', width: '100%', top: 10 }); win.add(tf); var ta = Ti.UI.createTextArea({ hintText: "Type here, mein Freund", font: {fontFamily: 'Chantelli_antiqua', fontSize: '15dp'}, height: '80dp', width: '100%', borderRadius: '5', top: 10 }); win.add(ta); var btn = Ti.UI.createButton({ font: {fontFamily: 'Chantelli_antiqua', fontSize: '15dp'}, title: 'I am a button', height: 'auto', width: 'auto', top: 10 }); win.add(btn); var btn2 = Ti.UI.createButton({ font: {fontFamily: 'Chantelli_antiqua', fontSize: '15dp', fontWeight: 'bold'}, title: 'I am also a button', height: 'auto', width: 'auto', top: 10 }); win.add(btn2); var btn3 = Ti.UI.createButton({ font: {fontFamily: 'Chantelli_antiqua', fontSize: '25dp', fontWeight: 'bold'}, title: 'Ah, but so am I a button', height: 'auto', width: 'auto', top: 10 }); win.add(btn3); win.open();</code> </pre> <p>Notice in several places we're setting <code>font: {fontFamily: 'Chantelli_antiqua' ... }</code>. (Case doesn't matter.)</p> <p>When you run it, you will (or should) notice that the font is not a standard font. See attached screenshot.png.</p></div>{html}
        Hide
        Bill Dawson added a comment -
        {html}<div><p>(from <a href=
        "/projects/32238/changesets/0243d42c591e2ec96defa95302597f27fb21af19"
        title=
        "Changeset [0243d42c591e2ec96defa95302597f27fb21af19]">[0243d42c591e2ec96defa95302597f27fb21af19]</a>)
        Move the default font file location to Resources/fonts so as to
        take advantage of our built-in builder.py file
        delta/deletion/addition checking. [<a href=
        "/projects/32238/tickets/3418" title="Ticket #3418">#3418</a>]
        <a href=
        "https://github.com/appcelerator/titanium_mobile/commit/0243d42c591e2ec96defa95302597f27fb21af19">
        https://github.com/appcelerator/titanium_mobile/commit/0243d42c591e...</a></p></div>{html}
        Show
        Bill Dawson added a comment - {html}<div><p>(from <a href= "/projects/32238/changesets/0243d42c591e2ec96defa95302597f27fb21af19" title= "Changeset [0243d42c591e2ec96defa95302597f27fb21af19] "> [0243d42c591e2ec96defa95302597f27fb21af19] </a>) Move the default font file location to Resources/fonts so as to take advantage of our built-in builder.py file delta/deletion/addition checking. [<a href= "/projects/32238/tickets/3418" title="Ticket #3418">#3418</a>] <a href= "https://github.com/appcelerator/titanium_mobile/commit/0243d42c591e2ec96defa95302597f27fb21af19"> https://github.com/appcelerator/titanium_mobile/commit/0243d42c591e ...</a></p></div>{html}
        Hide
        Bill Dawson added a comment -
        {html}<div><p>(from <a href=
        "/projects/32238/changesets/9a03aba397daa01ca562a7f82192bf82791cd0c1"
        title=
        "Changeset [9a03aba397daa01ca562a7f82192bf82791cd0c1]">[9a03aba397daa01ca562a7f82192bf82791cd0c1]</a>)
        Support custom fonts loaded in assets/fonts. [<a href=
        "/projects/32238/tickets/3418" title="Ticket #3418">#3418</a>]
        <a href=
        "https://github.com/appcelerator/titanium_mobile/commit/9a03aba397daa01ca562a7f82192bf82791cd0c1">
        https://github.com/appcelerator/titanium_mobile/commit/9a03aba397da...</a></p></div>{html}
        Show
        Bill Dawson added a comment - {html}<div><p>(from <a href= "/projects/32238/changesets/9a03aba397daa01ca562a7f82192bf82791cd0c1" title= "Changeset [9a03aba397daa01ca562a7f82192bf82791cd0c1] "> [9a03aba397daa01ca562a7f82192bf82791cd0c1] </a>) Support custom fonts loaded in assets/fonts. [<a href= "/projects/32238/tickets/3418" title="Ticket #3418">#3418</a>] <a href= "https://github.com/appcelerator/titanium_mobile/commit/9a03aba397daa01ca562a7f82192bf82791cd0c1"> https://github.com/appcelerator/titanium_mobile/commit/9a03aba397da ...</a></p></div>{html}
        Hide
        Bill Dawson added a comment -
        {html}<div><p>QE: please test both in master and 1_6_X, as it was specifically
        requested that this feature be added to 1_6_X</p></div>{html}
        Show
        Bill Dawson added a comment - {html}<div><p>QE: please test both in master and 1_6_X, as it was specifically requested that this feature be added to 1_6_X</p></div>{html}
        Hide
        Natalie Huynh added a comment -

        Tested with [INFO] Titanium SDK version: 1.6.2 (04/18/11 17:16 878906d) on
        Nexus S 2.3.2
        Emulator 2.1

        Show
        Natalie Huynh added a comment - Tested with [INFO] Titanium SDK version: 1.6.2 (04/18/11 17:16 878906d) on Nexus S 2.3.2 Emulator 2.1

          People

          • Assignee:
            Don Thorp
            Reporter:
            Alan Leard
          • Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development