<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xml:base="http://www.newlc.com" xmlns:dc="http://purl.org/dc/elements/1.1/">
<channel>
 <title>NewLC - how can I change the font for CEikRichTextEditor - Comments</title>
 <link>http://www.newlc.com/forum/how-can-i-change-font-ceikrichtexteditor</link>
 <description>Comments for &quot;how can I change the font for CEikRichTextEditor&quot;</description>
 <language>en</language>
<item>
 <title>Re: how can I change the font for CEikRichTextEditor</title>
 <link>http://www.newlc.com/forum/how-can-i-change-font-ceikrichtexteditor#comment-46190</link>
 <description>&lt;p&gt;Hi René,&lt;/p&gt;

&lt;p&gt;Thanks for your quick reply.&lt;/p&gt;

&lt;p&gt;I have get all the converted chars by the code&lt;/p&gt;

&lt;p&gt;aTextControl.Text()-&gt;Extract(fullPath,0);&lt;/p&gt;

&lt;p&gt;Then I show one char by using the method you suggest and it works.&lt;br /&gt;
aTextControl.SetTextL(&amp;fullPath.Mid(12,1));&lt;/p&gt;

&lt;p&gt; Now the question is to show the 2nd and 5th character at one line. &lt;br /&gt;
For example, I need to show fullPath.Mid(2,1) and fullPath.Mid(5,1) at one line. So the combine of the characters shall be done. &lt;/p&gt;

&lt;p&gt;Do you have better solution to use? &lt;/p&gt;

&lt;p&gt;So far, I solve it by declare another TBuf &lt;50&gt;  testString;&lt;br /&gt;
testString.Append(fullPath[2]);&lt;br /&gt;
testString.Append(fullPath[5]);&lt;br /&gt;
aTextControl.SetTextL(&amp;testString);&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;</description>
 <pubDate>Tue, 06 May 2008 12:06:28 +0200</pubDate>
 <dc:creator>marshalsh</dc:creator>
 <guid isPermaLink="false">comment 46190 at http://www.newlc.com</guid>
</item>
<item>
 <title>Re: how can I change the font for CEikRichTextEditor</title>
 <link>http://www.newlc.com/forum/how-can-i-change-font-ceikrichtexteditor#comment-46187</link>
 <description>&lt;p&gt;Hard to say why ConvertToUnicode() did not work for you; as far as I remember it should be the right method to call for UTF-8 to UTF-16 conversion. Anyway, if your ImportTextL trick works, so far so good.&lt;/p&gt;

&lt;p&gt;For extracting parts of a descriptor have a look at TDesC::Mid().&lt;br /&gt;
&lt;/p&gt;</description>
 <pubDate>Tue, 06 May 2008 11:31:21 +0200</pubDate>
 <dc:creator>rbrunner</dc:creator>
 <guid isPermaLink="false">comment 46187 at http://www.newlc.com</guid>
</item>
<item>
 <title>Re: how can I change the font for CEikRichTextEditor</title>
 <link>http://www.newlc.com/forum/how-can-i-change-font-ceikrichtexteditor#comment-46185</link>
 <description>&lt;p&gt;Hi René,&lt;/p&gt;

&lt;p&gt;Now i back to work from the holiday. And I replace the code &lt;br /&gt;
_LIT(chineseFont, &quot;Chinese Calendar&quot;);&lt;br /&gt;
and it works now. So the Chinese Calendar is the facename of the font.&lt;/p&gt;

&lt;p&gt;Now I encounter another problem about the descriptor. The code is as follows:&lt;/p&gt;

&lt;p&gt;void CSMS4CCR2AppUi:: ShowTextL(CEikEdwin&amp; aTextControl)&lt;br /&gt;
{&lt;br /&gt;
	aTextControl.Text()-&gt;Reset();&lt;br /&gt;
	RFileBuf fileBuf;&lt;br /&gt;
	fullPath.Copy(KFilename); //give the file name&lt;br /&gt;
	GetFullPathName(fullPath); //combine the filename and path&lt;br /&gt;
	if(fileBuf.Open(iEikonEnv-&gt;FsSession(),fullPath,EFileRead) == EFileRead)&lt;br /&gt;
	{&lt;br /&gt;
		CleanupClosePushL(fileBuf);&lt;br /&gt;
		RReadStream input(&amp;fileBuf);&lt;br /&gt;
		CleanupClosePushL(input);&lt;br /&gt;
		&lt;br /&gt;
		CPlainText::TImportExportParam params;&lt;br /&gt;
		params.iGuessForeignEncoding = ETrue;&lt;br /&gt;
		CPlainText::TImportExportResult result;&lt;br /&gt;
		TRAPD(error, aTextControl.Text()-&gt;ImportTextL(0,input,params,result));			&lt;br /&gt;
		if(error != KErrNone)&lt;br /&gt;
		{&lt;br /&gt;
			UpdateInstruction(_L(&quot;Importtext fails!&quot;));&lt;br /&gt;
		}&lt;br /&gt;
		//aTextControl.Text()-&gt;Extract(fullPath,12);&lt;/p&gt;

&lt;p&gt;		CleanupStack::PopAndDestroy(2); // input, fileBuf 	&lt;br /&gt;
		&lt;br /&gt;
		//aTextControl.SetTextL(&amp;*fullPath); &lt;br /&gt;
		&lt;br /&gt;
		HBufC *text = NULL;&lt;br /&gt;
		text=aTextControl.GetTextInHBufL();&lt;br /&gt;
		//text=aTextControl.Text();&lt;br /&gt;
		&lt;br /&gt;
		aTextControl.SetTextL(text);&lt;br /&gt;
		&lt;br /&gt;
		aTextControl.NotifyNewDocumentL(); // Formats and draws a new document, updates scrollbars if necessary&lt;br /&gt;
		aTextControl.UpdateAllFieldsL(); // Updates all the fields in the document		&lt;br /&gt;
		delete text;		&lt;br /&gt;
	}&lt;br /&gt;
	else&lt;br /&gt;
	{&lt;br /&gt;
		UpdateInstruction(_L(&quot;cannot find file&quot;));&lt;br /&gt;
	}&lt;br /&gt;
}&lt;/p&gt;

&lt;p&gt;As I have some chinese characters in the txt file(in utf8 format), I tried ConverToUnicode and it&#039;s not working. It works with me now by using ImportTextL which convert the characters internally. &lt;br /&gt;
What i want now is to get the aTextControl.Text() into an descriptor and pass some of them to the function aTextControl.SetTextL(const TDesC* aDes). &lt;br /&gt;
For example, there are 5 chars in the descriptor and I only want the 3rd char. &lt;br /&gt;
Can you help me with that? I am not good at descriptor at all.   &lt;img src=&quot;/sites/all/modules/smileys/packs/example/sad.png&quot; title=&quot;Sad&quot; alt=&quot;Sad&quot; /&gt;&lt;br /&gt;
&lt;/p&gt;</description>
 <pubDate>Tue, 06 May 2008 11:20:24 +0200</pubDate>
 <dc:creator>marshalsh</dc:creator>
 <guid isPermaLink="false">comment 46185 at http://www.newlc.com</guid>
</item>
<item>
 <title>Re: how can I change the font for CEikRichTextEditor</title>
 <link>http://www.newlc.com/forum/how-can-i-change-font-ceikrichtexteditor#comment-46095</link>
 <description>&lt;p&gt;Uh, &quot;Chinese Calendar&quot; does not sound too good.&lt;/p&gt;

&lt;p&gt;If you get problems with that font: I myself am using a font called SimSun (I am sure that this is the facename), contained in a font file simsun.ttf, that is more or less in the public domain. You can download the font e.g. here:&lt;br /&gt;
&lt;a href=&quot;http://www.vietnamtourism.com/c_pages/font/simsum.htm&quot; class=&quot;bb-url&quot;&gt;http://www.vietnamtourism.com/c_pages/font/simsum.htm&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Looks ok for Hanzi. However as a TrueType font, it needs the FreeType font renderer, as I explained in some other thread about fonts.&lt;br /&gt;
&lt;/p&gt;</description>
 <pubDate>Wed, 30 Apr 2008 17:59:51 +0200</pubDate>
 <dc:creator>rbrunner</dc:creator>
 <guid isPermaLink="false">comment 46095 at http://www.newlc.com</guid>
</item>
<item>
 <title>Re: how can I change the font for CEikRichTextEditor</title>
 <link>http://www.newlc.com/forum/how-can-i-change-font-ceikrichtexteditor#comment-46091</link>
 <description>&lt;p&gt;Oh, that&#039;s wonderful.&lt;/p&gt;

&lt;p&gt;Actually, as I am using a phone bought in EU, so there is no chinese font installed for sure. The chinese font inside the phone are installed by installing an sis application, which allows the pen to write chinese characters. By using the Fontviewer, it shows me:&lt;br /&gt;
Chinese Calendar&lt;br /&gt;
FixedHeight - FixedWidth&lt;/p&gt;

&lt;p&gt;and I am wondering whether it is the facename of the chinese.gdr. As I am not in the company, I am not able to test it today. I will let you know tomorrow. &lt;/p&gt;

&lt;p&gt;Besides, I found the code to print the facename in NewLC, as follows.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;http://www.newlc.com/topic-16251&quot;&gt;http://www.newlc.com/topic-16251&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I will try that as well. Now I am a little more confident that things are going to work. Thanks &lt;img src=&quot;/sites/all/modules/smileys/packs/example/smile.png&quot; title=&quot;Smiling&quot; alt=&quot;Smiling&quot; /&gt;&lt;/p&gt;</description>
 <pubDate>Wed, 30 Apr 2008 13:47:20 +0200</pubDate>
 <dc:creator>marshalsh</dc:creator>
 <guid isPermaLink="false">comment 46091 at http://www.newlc.com</guid>
</item>
<item>
 <title>Re: how can I change the font for CEikRichTextEditor</title>
 <link>http://www.newlc.com/forum/how-can-i-change-font-ceikrichtexteditor#comment-46088</link>
 <description>&lt;p&gt;Maybe good to know: There are freeware utilities that are able to show you all installed fonts, with their facename. This is not only useful in cases like your case now where you don&#039;t know yet the facename, it&#039;s also useful to verify that UIQ really did accept the font that you tried to install. If UIQ does not like a font file, it does not give you an error message, but just silently ignores the font, and later you scratch your head why on earth your program is not able to select the font - it simply is not there, as far as UIQ is concerned.&lt;/p&gt;

&lt;p&gt;One such utility you can find here:&lt;br /&gt;
&lt;a href=&quot;http://www.dishneau.com/symbian/UIQFont.htm&quot; class=&quot;bb-url&quot;&gt;http://www.dishneau.com/symbian/UIQFont.htm&lt;/a&gt;&lt;br /&gt;
&lt;/p&gt;</description>
 <pubDate>Wed, 30 Apr 2008 11:40:42 +0200</pubDate>
 <dc:creator>rbrunner</dc:creator>
 <guid isPermaLink="false">comment 46088 at http://www.newlc.com</guid>
</item>
<item>
 <title>Re: how can I change the font for CEikRichTextEditor</title>
 <link>http://www.newlc.com/forum/how-can-i-change-font-ceikrichtexteditor#comment-46087</link>
 <description>&lt;p&gt;Thanks for your quick reply. &lt;/p&gt;

&lt;p&gt;I see the mistake I made, by searching the internet, I do not find the facename of the chinese.gdr.  I am now trying to find another font along with its facename. Besides, I will take your advice and try to use the CGlobalText::SetGlobalCharFormat. &lt;/p&gt;

&lt;p&gt;I will let you know how it goes. Thanks again : )&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;</description>
 <pubDate>Wed, 30 Apr 2008 11:28:13 +0200</pubDate>
 <dc:creator>marshalsh</dc:creator>
 <guid isPermaLink="false">comment 46087 at http://www.newlc.com</guid>
</item>
<item>
 <title>Re: how can I change the font for CEikRichTextEditor</title>
 <link>http://www.newlc.com/forum/how-can-i-change-font-ceikrichtexteditor#comment-46079</link>
 <description>&lt;p&gt;There are several problems with your code:&lt;/p&gt;

&lt;p&gt;The TFontSpec constructor does not want a file name, it wants a font facename. You have to find out the facename of your font and pass that to TFontSpec.&lt;/p&gt;

&lt;p&gt;TFontSpec wants the font size in 1/20 points, i.e. in twips. Don&#039;t pass it 16, pass it 16*20 for a 16 point font.&lt;/p&gt;

&lt;p&gt;In iCharFormatMask you set only the EAttFontHeight attribute, but you want not only to set font height, but also the typeface. You need the corresponding flag as well.&lt;/p&gt;

&lt;p&gt;By the way, it would be better to work with a CCharFormatLayer that you construct yourself. If you use CGlobalText::SetGlobalCharFormat, after you got the CGlobalText that is the base of the RichTextEditor, by using something like&lt;br /&gt;
&lt;div class=&quot;codeblock&quot;&gt;&lt;code&gt;CGlobalText* iGlobalText=(CGlobalText*)(iRichTextEditor-&amp;gt;Text());&lt;/code&gt;&lt;/div&gt;&lt;br /&gt;
the new font becomes something like the default font for that particular control, automatically used for any new text that you type.&lt;br /&gt;
&lt;/p&gt;</description>
 <pubDate>Tue, 29 Apr 2008 18:07:23 +0200</pubDate>
 <dc:creator>rbrunner</dc:creator>
 <guid isPermaLink="false">comment 46079 at http://www.newlc.com</guid>
</item>
<item>
 <title>how can I change the font for CEikRichTextEditor</title>
 <link>http://www.newlc.com/forum/how-can-i-change-font-ceikrichtexteditor</link>
 <description>&lt;p&gt;I am developing application on A1000 UIQ2.1. However the phone I use only has English.&lt;br /&gt;
Now i have put the Chinese.gdr into c:\system\fonts folder. &lt;/p&gt;

&lt;p&gt;The code i use is as follows:&lt;/p&gt;

&lt;p&gt;_LIT(chineseFont, &quot;C:\\system\\fonts\\chinese.gdr&quot;);&lt;/p&gt;

&lt;p&gt;In the ConstructL the code is:&lt;/p&gt;

&lt;p&gt;TFontSpec fontSpec(chineseFont,16);&lt;br /&gt;
CGraphicsDevice* screenDevice=iEikonEnv-&gt;ScreenDevice( );&lt;br /&gt;
CFont* font;&lt;br /&gt;
&lt;/p&gt;&lt;p&gt;&lt;a href=&quot;http://www.newlc.com/forum/how-can-i-change-font-ceikrichtexteditor&quot;&gt;read more&lt;/a&gt;&lt;/p&gt;</description>
 <comments>http://www.newlc.com/forum/how-can-i-change-font-ceikrichtexteditor#comments</comments>
 <category domain="http://www.newlc.com/forums/uiq-phones">UIQ Phones</category>
 <pubDate>Tue, 29 Apr 2008 13:01:58 +0200</pubDate>
 <dc:creator>marshalsh</dc:creator>
 <guid isPermaLink="false">20826 at http://www.newlc.com</guid>
</item>
</channel>
</rss>
