Git Product home page Git Product logo

furigana-view's People

Contributors

sh0 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

furigana-view's Issues

Scrolling

Does furigana-view support scrolling gesture like original textview?

Consider licensing other than Creative Commons

Please consider releasing this software under a license other than Creative Commons. CC themselves say:

We recommend against using Creative Commons licenses for software. Instead, we strongly encourage you to use one of the very good software licenses which are already available. We recommend considering licenses made available by the Free Software Foundation or listed as “open source” by the Open Source Initiative.

As for compatible licenses with BY-SA 3.0:

Currently, no non-CC licenses have been designated as compatible with BY-SA 3.0. Other licenses may be added to this list at any time according to the established process and criteria. Once a license has been added to this list, it will not be removed.

The present terms limit adoption of the software in both Open Source and proprietary software contexts.

See also: https://choosealicense.com/

Thanks!

Line break in input string

Thank you for great custom view !
How can I deal with string which have line break characters( \n, \r ) in it.I expect that FuriganaView will break lines like normal TextView but it seems that FuriganaView ignore line break character (correct me if I am wrong).
Can you tell me how to make line break character work ? I'll be very happy if you give me some code or instructions.
Regards,

Furigana text being drawn outside of view area

When there are long furigana readings for short kanji on the edge of a textview, it will draw the furigana text outside of the view area.

This is caused when the length of the furigana text is longer than the text that it is drawn over and the text is on the edge of the canvas. When the text is on the left edge of the canvas, the x value will go negative and text draw will start outside of the canvas. The same can happen if the text is on the right side, the furigana will run outside of the canvas.

(left side error)
error

The problem comes from this part of TextFurigana

    // Draw
    public void draw(Canvas canvas, float x, float y)
    {
        x -= m_width / 2.0f;
        canvas.drawText(m_text, 0, m_text.length(), x, y, m_paint_f);
    }

To fix this just add a check the bounds of the canvas. The x value should be between 0 and canvas width minus the width of the text.
right_fix
left_fix

    // Draw
    public void draw(Canvas canvas, float x, float y)
    {
        x -= m_width / 2.0f;
        if(x < 0){
            x = 0;
        }
        else if(x + m_width > canvas.getWidth()){
            x = canvas.getWidth() - m_width;
        }
        canvas.drawText(m_text, 0, m_text.length(), x, y, m_paint_f);
    }

Android Studio design view rendering problem (Array index out of range: 0)

In the design view in Android Studio, a furigana view item will cause a rendering problem and an error message to show (see below).

This is caused when the m_span vector is empty and an attempt to get the first element is made without checking to see if it has an element.

To fix this change the following in text_calculate(float line_max)

        // Initial span
        int span_i = 0;
        Span span = m_span.get(span_i);

to

        // Initial span            
        Span span = null;
        if(m_span.size() != 0) {
            span = m_span.get(span_i);
        }

java.lang.ArrayIndexOutOfBoundsException: Array index out of range: 0 at java.util.Vector.get(Vector.java:748) at *.furigana_view.FuriganaView.text_calculate(FuriganaView.java:495) at *.furigana_view.FuriganaView.onMeasure_Original(FuriganaView.java:434) at *.furigana_view.FuriganaView.onMeasure(FuriganaView.java) at android.view.View.measure(View.java:18788) at android.widget.RelativeLayout.measureChildHorizontal(RelativeLayout.java:715) at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:461) at android.view.View.measure(View.java:18788) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5951) at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1465) at android.widget.LinearLayout.measureVertical(LinearLayout.java:748) at android.widget.LinearLayout.onMeasure(LinearLayout.java:630) at android.view.View.measure(View.java:18788) at android.widget.RelativeLayout.measureChildHorizontal(RelativeLayout.java:715) at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:461) at android.view.View.measure(View.java:18788) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5951) at android.widget.FrameLayout.onMeasure(FrameLayout.java:194) at android.view.View.measure(View.java:18788) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5951) at android.support.v7.internal.widget.ActionBarOverlayLayout.onMeasure_Original(ActionBarOverlayLayout.java:453) at android.support.v7.internal.widget.ActionBarOverlayLayout.onMeasure(ActionBarOverlayLayout.java) at android.view.View.measure(View.java:18788) at android.widget.RelativeLayout.measureChildHorizontal(RelativeLayout.java:715) at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:461) at android.view.View.measure(View.java:18788) at com.android.layoutlib.bridge.impl.RenderSessionImpl.measureView(RenderSessionImpl.java:494) at com.android.layoutlib.bridge.impl.RenderSessionImpl.render(RenderSessionImpl.java:371) at com.android.layoutlib.bridge.Bridge.createSession(Bridge.java:428) at com.android.ide.common.rendering.LayoutLibrary.createSession(LayoutLibrary.java:350) at com.android.tools.idea.rendering.RenderTask$2.compute(RenderTask.java:520) at com.android.tools.idea.rendering.RenderTask$2.compute(RenderTask.java:508) at com.intellij.openapi.application.impl.ApplicationImpl.runReadAction(ApplicationImpl.java:967) at com.android.tools.idea.rendering.RenderTask.createRenderSession(RenderTask.java:508) at com.android.tools.idea.rendering.RenderTask.access$600(RenderTask.java:75) at com.android.tools.idea.rendering.RenderTask$3.call(RenderTask.java:620) at com.android.tools.idea.rendering.RenderTask$3.call(RenderTask.java:617) at com.android.tools.idea.rendering.RenderService.runRenderAction(RenderService.java:371) at com.android.tools.idea.rendering.RenderTask.render(RenderTask.java:617) at com.android.tools.idea.rendering.RenderTask.render(RenderTask.java:639) at com.intellij.android.designer.designSurface.AndroidDesignerEditorPanel$7.run(AndroidDesignerEditorPanel.java:519) at com.intellij.util.ui.update.MergingUpdateQueue.execute(MergingUpdateQueue.java:337) at com.intellij.util.ui.update.MergingUpdateQueue.execute(MergingUpdateQueue.java:327) at com.intellij.util.ui.update.MergingUpdateQueue$3.run(MergingUpdateQueue.java:271) at com.intellij.util.ui.update.MergingUpdateQueue.flush(MergingUpdateQueue.java:286) at com.intellij.util.ui.update.MergingUpdateQueue.flush(MergingUpdateQueue.java:244) at com.intellij.util.ui.update.MergingUpdateQueue.run(MergingUpdateQueue.java:234) at com.intellij.util.concurrency.QueueProcessor.runSafely(QueueProcessor.java:238) at com.intellij.util.Alarm$Request$1.run(Alarm.java:352) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.