Khmer not support #57
Comments
It is because your words are too long. What you can try to do is increase the font size. Make sure to use |
Here is my java : public class MainActivity extends Activity {
} But still get the same result. |
Your words are too long. Give me a day or two to add support for this. — On Mon, Jan 19, 2015 at 2:18 AM, Bunthoeun notifications@github.com
|
Yes thank you so much. I can give some string: សៀវភៅដំបូងដែលគ្រឹះស្ថាន «ប្រភពប្រាជ្ញា» បានបោះពុម្ពនោះ គឺជាស្នាដៃរបស់អ្នកនិពន្ធ ប៉ែន តារាឫទ្ធិ ដែលជាការបកស្រាយអំពីកណ្ឌអេភេសូរ។ ទោះបើអ្នកប្រាជ្ញខាងគម្ពីរ និង អ្នកនិពន្ធរូបនេះ បានចែកឋានប៉ុន្មានអាទិត្យមុនពេល ដែលសៀវភៅនេះបានចែកចាយក៏ដោយ ក៏ស្នាដៃរបស់អ្នកនិពន្ធ ប៉ែន តារាឫទ្ធិ នៅតែដក់ជាប់ក្នុងចិត្តមនុស្សគ្រប់ជំនាន់ តាមរយៈសៀវភៅនេះដែរ។ បច្ចុប្បន្ននេះ «ប្រភពប្រាជ្ញា» មានទីតាំងនៅផ្ទះលេខ១១អា ផ្លូវលេខ២០០២ សង្កាត់ទឹកថ្លា ខណ្ឌសែនសុខ រាជធានីភ្នំពេញ។ មានបុគ្គលិកពេពេលជាជនជាតិខ្មែរ១១នាក់ សុទ្ធសឹងតែជាអ្នកមានជំនាញខ្ពស់ក្នុងវិស័យបោះពុម្ពផ្សាយ។ នោះជានិមិត្តចុងក្រោយរបស់លោកស្ទីវចំពោះ «ប្រភពប្រាជ្ញា» ដែលចង់ឃើញគ្រីស្ទបរិស័ទខ្មែរ ដឹកនាំពន្ធ័កិច្ចបោះពុម្ពផ្សាយដ៏សំខាន់នេះឆ្ពោះទៅពេលអនាគតដោយប្រសិទ្ធភាព។ |
@bpbunthoeun You can build your custom hyphenator for this. This way it will break the words at the right places. If you use the built in documentView.getDocumentLayoutParams().setTextAlignment(TextAlignment.JUSTIFIED);
documentView.getDocumentLayoutParams().setHyphenator(SqueezeHyphenator.getInstance());
documentView.getDocumentLayoutParams().setHyphenated(true); If you are having trouble, refer to CustomHyphenatorTest. Let me know how this goes for you. In the event, you don't like this hyphenator, you can build your own Hyphenator, just extend |
Dear Mathew, Thanks you very much for you answer, But I just get some error when use this DocumentView documentView = addDocumentView(new StringBuilder() Here is my full java I just tries to copy your example come to test how it going: package com.cambobox.documentview; import android.app.Activity; import com.bluejamesbond.text.DocumentView; public class MainActivity extends Activity {
} Thank you hope you are don't mind I'm not good in code. :) |
It should look more like this: package com.cambobox.documentview;
import android.app.Activity;
import android.os.Bundle;
import com.bluejamesbond.text.DocumentView;
import com.bluejamesbond.text.hyphen.SqueezeHyphenator;
import com.bluejamesbond.text.style.TextAlignment;
public class MainActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// set layout
setContentView(R.layout.activity_main);
// text you want
String text = "សៀវភៅដំបូងដែលគ្រឹះស្ថាន «ប្រភពប្រាជ្ញា» បានបោះពុម្ពនោះ គឺជាស្នាដៃរបស់អ្នកនិពន្ធ ប៉ែន តារាឫទ្ធិ ដែលជាការបកស្រាយអំពីកណ្ឌអេភេសូរ។ ទោះបើអ្នកប្រាជ្ញខាងគម្ពីរ និង អ្នកនិពន្ធរូបនេះ បានចែកឋានប៉ុន្មានអាទិត្យមុនពេល ដែលសៀវភៅនេះបានចែកចាយក៏ដោយ ក៏ស្នាដៃរបស់អ្នកនិពន្ធ ប៉ែន តារាឫទ្ធិ នៅតែដក់ជាប់ក្នុងចិត្តមនុស្សគ្រប់ជំនាន់ តាមរយៈសៀវភៅនេះដែរ។ បច្ចុប្បន្ននេះ «ប្រភពប្រាជ្ញា» មានទីតាំងនៅផ្ទះលេខ១១អា ផ្លូវលេខ២០០២ សង្កាត់ទឹកថ្លា ខណ្ឌសែនសុខ រាជធានីភ្នំពេញ។ មានបុគ្គលិកពេពេលជាជនជាតិខ្មែរ១១នាក់ សុទ្ធសឹងតែជាអ្នកមានជំនាញខ្ពស់ក្នុងវិស័យបោះពុម្ពផ្សាយ។ នោះជានិមិត្តចុងក្រោយរបស់លោកស្ទីវចំពោះ «ប្រភពប្រាជ្ញា» ដែលចង់ឃើញគ្រីស្ទបរិស័ទខ្មែរ ដឹកនាំពន្ធ័កិច្ចបោះពុម្ពផ្សាយដ៏សំខាន់នេះឆ្ពោះទៅពេលអនាគតដោយប្រសិទ្ធភាព។";
// create DocumentView
DocumentView documentView = new DocumentView(this, DocumentView.PLAIN_TEXT);
// set the properties
documentView.getDocumentLayoutParams().setTextColor(0xffffffff);
documentView.getDocumentLayoutParams().setTextTypeface(Typeface.DEFAULT);
documentView.getDocumentLayoutParams().setTextSize(14);
documentView.getDocumentLayoutParams().setTextAlignment(TextAlignment.JUSTIFIED);
documentView.getDocumentLayoutParams().setInsetPaddingLeft(30f);
documentView.getDocumentLayoutParams().setInsetPaddingRight(30f);
documentView.getDocumentLayoutParams().setInsetPaddingTop(30f);
documentView.getDocumentLayoutParams().setInsetPaddingBottom(30f);
documentView.getDocumentLayoutParams().setLineHeightMultiplier(1f);
documentView.getDocumentLayoutParams().setHyphenator(SqueezeHyphenator.getInstance());
documentView.getDocumentLayoutParams().setHyphenated(true);
// set text
documentView.setText(text)
// ****************** you have to edit this ******************
((SomeLayout) findViewById(R.id.some_layout)).addView(documentView)
}
} |
Ok. I provided u with the code in my last post. Try that out. — On Tue, Jan 20, 2015 at 11:40 PM, Bunthoeun notifications@github.com
|
Thank you but please tell me what should I edit in your code? this is my XML :
|
"Unfortunately, Document View has stopped" this is the message that I got when I run on my phone. and this some code that I edited |
You should study more about Android, but I will help you here. activity_main.xml <?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:paddingTop="15dp"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:id="@+id/main_layout"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</LinearLayout> MainActivity.java package com.cambobox.documentview;
import android.app.Activity;
import android.os.Bundle;
import com.bluejamesbond.text.DocumentView;
import com.bluejamesbond.text.hyphen.SqueezeHyphenator;
import com.bluejamesbond.text.style.TextAlignment;
public class MainActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// set layout
setContentView(R.layout.activity_main);
// text you want
String text = "សៀវភៅដំបូងដែលគ្រឹះស្ថាន «ប្រភពប្រាជ្ញា» បានបោះពុម្ពនោះ គឺជាស្នាដៃរបស់អ្នកនិពន្ធ ប៉ែន តារាឫទ្ធិ ដែលជាការបកស្រាយអំពីកណ្ឌអេភេសូរ។ ទោះបើអ្នកប្រាជ្ញខាងគម្ពីរ និង អ្នកនិពន្ធរូបនេះ បានចែកឋានប៉ុន្មានអាទិត្យមុនពេល ដែលសៀវភៅនេះបានចែកចាយក៏ដោយ ក៏ស្នាដៃរបស់អ្នកនិពន្ធ ប៉ែន តារាឫទ្ធិ នៅតែដក់ជាប់ក្នុងចិត្តមនុស្សគ្រប់ជំនាន់ តាមរយៈសៀវភៅនេះដែរ។ បច្ចុប្បន្ននេះ «ប្រភពប្រាជ្ញា» មានទីតាំងនៅផ្ទះលេខ១១អា ផ្លូវលេខ២០០២ សង្កាត់ទឹកថ្លា ខណ្ឌសែនសុខ រាជធានីភ្នំពេញ។ មានបុគ្គលិកពេពេលជាជនជាតិខ្មែរ១១នាក់ សុទ្ធសឹងតែជាអ្នកមានជំនាញខ្ពស់ក្នុងវិស័យបោះពុម្ពផ្សាយ។ នោះជានិមិត្តចុងក្រោយរបស់លោកស្ទីវចំពោះ «ប្រភពប្រាជ្ញា» ដែលចង់ឃើញគ្រីស្ទបរិស័ទខ្មែរ ដឹកនាំពន្ធ័កិច្ចបោះពុម្ពផ្សាយដ៏សំខាន់នេះឆ្ពោះទៅពេលអនាគតដោយប្រសិទ្ធភាព។";
// create DocumentView
DocumentView documentView = new DocumentView(this, DocumentView.PLAIN_TEXT);
// set the properties
documentView.getDocumentLayoutParams().setTextColor(0xffffffff);
documentView.getDocumentLayoutParams().setTextTypeface(Typeface.DEFAULT);
documentView.getDocumentLayoutParams().setTextSize(14);
documentView.getDocumentLayoutParams().setTextAlignment(TextAlignment.JUSTIFIED);
documentView.getDocumentLayoutParams().setInsetPaddingLeft(30f);
documentView.getDocumentLayoutParams().setInsetPaddingRight(30f);
documentView.getDocumentLayoutParams().setInsetPaddingTop(30f);
documentView.getDocumentLayoutParams().setInsetPaddingBottom(30f);
documentView.getDocumentLayoutParams().setLineHeightMultiplier(1f);
documentView.getDocumentLayoutParams().setHyphenator(SqueezeHyphenator.getInstance());
documentView.getDocumentLayoutParams().setHyphenated(true);
// set text
documentView.setText(text)
// add to layout
((LinearLayout) findViewById(R.id.main_layout)).addView(documentView)
}
} |
Yes, thank you very much you.. it is working ..... 👍 |
Thank you so much for you library it is very helpful, but I got the problem when I use it with Khmer unicode. it doesn't working well. Can you please help me to to finger-out this problem.
Thank you.
Bunthoeun
The text was updated successfully, but these errors were encountered: