View Issue Details

IDProjectCategoryView StatusLast Update
0015629ScribusScripterpublic2019-06-04 20:55
Reporterale Assigned Tojghali  
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
Product Version1.5.5.svn 
Fixed in Version1.5.5.svn 
Summary0015629: Calling createCharStyle() with no arguments creates a style with a font size of 200 pt
Descriptionrunning

scribus.createCharStyle('stylename')

creates a style with a font size of 200 pt... which is not a sane size.
TagsNo tags attached.
PatchNo

Relationships

related to 0015631 closedjghali make StyleSet::getDefault() const 

Activities

ale

2019-04-04 09:36

manager   ~0046062

... ok i see that there were a few more commit last night...

... i'll merge them and do my tests again...

ale

2019-04-04 09:48

manager   ~0046063

the 200pt are still a problem... i've reduced the ticket to the part that is still relevant...

thanks jean for fixing the font selection! that part now works

ale

2019-04-04 09:50

manager   ~0046064

btw, a simpler and probably better solution for picking the font: use the default from the preferences > item tools > text.

ale

2019-04-04 11:39

manager   ~0046065

the other way round:

the scripter should create a copy of "Default Character Style" instead of creating new style from scratch. It should also get the default values from "Default Character Style", instead of making up values.

or keeping on creating the style from thin air, but at least get the default values from the default char style.

i will try to make a patch for it.

ale

2019-04-04 13:45

manager   ~0046066

Last edited: 2019-04-04 13:55

ok, got it:

in scribus/plugins/scriptplugin/cmdstyle.cpp, scribus_createcharstyle(...) do:

const auto defaultStyle = ScCore->primaryMainWindow()->doc->charStyles().getDefault();
// ...
double FontSize = defaultStyle->fontSize() / 10, ...

correctly filling all the default values, is left to the reader as an exercise : - )

this way, it should be possible to remove most of yesterday's patch about picking the right font style...

ale

2019-04-04 13:53

manager   ~0046067

i can write a patch for all attributes if you plan to apply it "as is"...

jghali

2019-04-07 14:05

administrator   ~0046083

>> the scripter should create a copy of "Default Character Style" instead of creating new style from scratch. It should also get the default values from "Default Character Style", instead of making up values.

While in theory I agree, changing too much current behavior may break lots of existing scripts. So I would restrict the behavior change to font size.

ale

2019-04-08 12:47

manager   ~0046088

i don't think that people will notice the difference.

people who wanted any control on how the style is created, will add all the possible formatting.
the other people will probably not have changed the default style in a way that disrupts the creation of new styles based on the default style (instead of fixed value.. which should match a sane default).

in my eyes, it's way more important to have a consistent (and sane) behavior, rather than focus too much on keeping bad behavior around.

and such a change is not breaking existing documents, it just might require a change to scripts... but i don't think that many will be affected (if any!)

jghali

2019-04-13 12:21

administrator   ~0046127

I realized in fact yesterday that changing current behavior has another drawback: that will allow situations where a same script will produce different results on different workstations. I'm not sure we really want that.

ale

2019-04-15 06:39

manager   ~0046128

jean, where is the problem?

if somebody wants the same behavior everywhere, she has to set the default styles correctly or correctly define the new style.

relying on the defaults will give you the users defaults. i really don't see where the problem is.

of course, we need to be able to specify the parent style for a new style. i think i've created a ticket for that too!

p.s.: if you want a specific formatting you have to create a char style and build your other styles upon it. that sounds very sane to me.

jghali

2019-04-26 23:48

administrator   ~0046168

After discussion with Craig, it was in the end decided to change the behavior... which required some additional doc updates.

ale

2019-04-27 09:58

manager   ~0046169

nice, thanks!

Issue History

Date Modified Username Field Change
2019-04-04 09:34 ale New Issue
2019-04-04 09:36 ale Note Added: 0046062
2019-04-04 09:48 ale Summary Scripter: createCharStyle() with no arguments does not (always) create a valid font + font style && font size is 200pt => Scripter: createCharStyle() with no arguments the font size is 200pt
2019-04-04 09:48 ale Description Updated
2019-04-04 09:48 ale Note Added: 0046063
2019-04-04 09:50 ale Note Added: 0046064
2019-04-04 11:39 ale Note Added: 0046065
2019-04-04 13:45 ale Note Added: 0046066
2019-04-04 13:53 ale Note Added: 0046067
2019-04-04 13:55 ale Note Edited: 0046066
2019-04-04 14:12 ale Relationship added related to 0015631
2019-04-04 19:13 jghali Summary Scripter: createCharStyle() with no arguments the font size is 200pt => Calling createCharStyle() with no arguments creates a style with a font size of 200 pt
2019-04-07 14:05 jghali Note Added: 0046083
2019-04-08 12:47 ale Note Added: 0046088
2019-04-13 12:21 jghali Note Added: 0046127
2019-04-15 06:39 ale Note Added: 0046128
2019-04-26 23:48 jghali Assigned To => jghali
2019-04-26 23:48 jghali Status new => resolved
2019-04-26 23:48 jghali Resolution open => fixed
2019-04-26 23:48 jghali Fixed in Version => 1.5.5.svn
2019-04-26 23:48 jghali Note Added: 0046168
2019-04-27 09:58 ale Note Added: 0046169
2019-06-04 20:55 cbradney Status resolved => closed