Text

Answered

Change the displayviewcontroller's line color(Ruled line)

Hi,

I want to change the pages's ruled line color Gray into the Red.

I changed the "setTheme" color as per you said but it doesn't work properly.

SetTheme Color Code:

currently, in order to change the color of the guidelines, you can proceed as follows (replace #ff0000ff with the color code you prefer): editor.setTheme(".guide { color: #ff0000ff }");


How can i achieve that?


Best Answer

Dear Kannan,


can you please try to set the theme as follows: editorViewController.editor.theme = ".guide { color: #ff0000ff }" ?


Best regards,


Olivier


Dear Kannan,


when you say it doesn't work properly, what's wrong?


Indeed, in the "onCreate" function, I just added the following: editor.setTheme(".guide { color: #ff0000ff }");


Guidelines are of the #ff0000ff color.


So please explain what's no working properly on your side.


Best regards,


Olivier

Hi,

I just add a code in my editor engine configuration function for change that line color into "RED" color,

 do{

            editorViewController.editor.theme = "#FF0000"

            try  editorViewController.editor.configuration.setString("medicinecustom", forKey: "text.configuration.name")

 }

        catch{

            print("Error while creating package : " + error.localizedDescription)

 }

But still it's in the default gray color line.

That's the problem i have faced.How can i resolve that?


Answer

Dear Kannan,


can you please try to set the theme as follows: editorViewController.editor.theme = ".guide { color: #ff0000ff }" ?


Best regards,


Olivier

Hi,

Thank you for your quick response.

Above that code was working good.

But if i tap the buttons ,that color changed into the different colors.

EX:

If i tap the button "A" that color change to the dark gray color.

If i tab the button "B" that dark gray color changed into the white.

So my issue was ,Initially that color changed into the gray color when i'm entering in that page.

But After that i changed the color into white while i'm tapping some other button, it's not changed into the white color.

How can i reload that view? I want to multiple time switch that ruled line color.

How can i achieve that?

Dear Kannan,


after setting a new theme color, do you call the "invalidate" function: editorView.invalidate(); ?


This will normally help taking into account the color change.


Best regards,


Olivier

Hi ,

I didn't find that function. (editorView.invalidate(); ?)

Where its is in iOS SDK?

Should i create the new package?

Code:

After setting the color code and  create the new package by following code,

do {

            if let package = try createPackage(packageName: "New") {

                try editorViewController.editor.part = package.getPartAt(0)

 }

        } catch {

 print("Error while creating package : " + error.localizedDescription)

 }.

.


Hi,

It's working now.

I have call the Displayviewcontroller's Refereshview funtion.

So that issues was solved.

But I need a another help from you.

I want to increase the space between two lines.(Displayviewcontrollers ruled line spaces).

Now we can achieve that Pin and Pan zoom feature.

But i want to programmatically increase the space between two lines.

How can i achieve that?

Dear Kannan,


Currently, if in a "Text" part, the spacing of handwriting guides is given by font-size * line-height: https://developer.myscript.com/docs/interactive-ink/1.3/reference/styling/#text


If in a "Text Document" part, the line spacing cannot be tuned.


Best regards,


Olivier

Hi,

Thanks for your response.

Sorry to say this,

Which function i have to call for change that font size in iOS?.

Is there is any sample code for change the font size or please tell me which part i should change for increase the font size code where i'll be put that code?

Can you help me to solve this?


Dear Kannan,


if in a text part, you can refer to the following topic: https://developer-support.myscript.com/support/discussions/topics/16000027249


Best regards,


Olivier

Hi,

Thanks for your response.

It's working now olivier.

But I have an another problem.

1) If i set a theme for change the ruled line color , font size theme does not work.

2) If i hide the rule line's color change theme code ,font size theme will be working good.


My code was:

do{

 editorViewController.editor.waitForIdle()

 editorViewController.editor.clear()

 editorViewController.editor.theme = ".text{font-weight: 900; font-size: 15;}"

 editorViewController.editor.theme = ".guide { color: #ffffff }"

 try editorViewController.editor.configuration.setString("text", forKey: "text.configuration.name")

 }

            catch{

 print("Error while creating package : " + error.localizedDescription)

 }

So how can i achieve both?


Dear Kannan,


can you please try to set the theme as follows: editorViewController.editor.theme = ".text{font-weight: 900; font-size: 5;}" + ".guide { color: #ff0000 ;}"


Let us know if it doesn't work.


Best regards,


Olivier

Hi,

Above that code(editorViewController.editor.theme = ".text{font-weight: 900; font-size: 5;}" + ".guide { color: #ff0000 ;}") was working good.

Thanks for your response.