Closed Duanle closed 1 year ago
Normally this sort of thing is controlled by spacingLinear
and spacingNonLinear
options.
But this case is different since those parameters cannot produce the overlapping elements seen in the Android example by themselves.
It seems that the Android version is typesetting the music to something wider than pageWidth
(probably the default value of 2100) and then compressing the width of the music to 1080 after the castoff process (which it should not be doing). One idea is that this is related to an uninitialized variable that is set to 0 in MacOS and left to a more random state in Android.
Also the cross-staff stems/beams are incorrect. This could be a result of the master branch version being too old and maybe try the develop version instead to see if there is a difference.
The stems and beams are aligning vertically in 3.13.0-dev-1629c71
:
Transcoded from Humdrum
In your example they are not aligning properly (in both Android and MacOS):
Thank you for your reply, About the problem of "steps/teams" I will update to the new version later.I have tried the "spacingLinear" and "spacingNonLinear" parameters just now, and they really have no effect. Is there any other good solution to the Android problem? Or will you fix it later? Because my application runs on a mobile device, I need this function because the screen is small. Thanks again
Please send the file.
I think the toolkit is not available in the Android binding?
I think the toolkit is not available in the Android binding?
Probably not,I can use it to output svg and midi this is my jni code
extern "C" JNIEXPORT jobjectArray JNICALL
renderSvgFile(JNIEnv *env, jobject, jstring jResourcePath, jstring jInputFilePath,
jstring jOptionJson) {
const char *resourcePath = env->GetStringUTFChars(jResourcePath, NULL);
const char *inputFilePath = env->GetStringUTFChars(jInputFilePath, NULL);
const char *optionJson = env->GetStringUTFChars(jOptionJson, NULL);
std::string fileSuffix;
std::string fileName;
std::string folderPath;
getInputFileSuffix(inputFilePath, fileSuffix);
getInputFileName(inputFilePath, fileName);
getInputFolderPath(inputFilePath, folderPath);
vrv::Toolkit toolkit(false);
toolkit.SetResourcePath(resourcePath);
toolkit.LoadFile(inputFilePath);
toolkit.ResetOptions();
int count = toolkit.GetPageCount();
auto jArray = (jobjectArray) env->NewObjectArray(
count, env->FindClass("java/lang/String"), env->NewStringUTF(""));
toolkit.SetOptions(optionJson);
for (int p = 1; p < count + 1; p++) {
std::string cur_outfile = fileName;
cur_outfile += vrv::StringFormat("_%03d", p);
cur_outfile += ".svg";
std::string svgPath = vrv::StringFormat("%s%s", folderPath.c_str(), cur_outfile.c_str());
toolkit.RenderToSVGFile(svgPath, p);
env->SetObjectArrayElement(jArray, p - 1, env->NewStringUTF(svgPath.c_str()));
}
return jArray;
}
The problem is that you set the options after loading the file. That can work, but you need to call RedoLayout()
if you do so.
The problem is that you set the options after loading the file. That can work, but you need to call
RedoLayout()
if you do so.
That's exactly what you said,The display is normal
What happens if you change the order of calls:
...
vrv::Toolkit toolkit(false);
toolkit.SetResourcePath(resourcePath);
toolkit.ResetOptions(); // not really necessary because you've just initialized, but OK
toolkit.LoadFile(inputFilePath);
toolkit.SetOptions(optionJson);
int count = toolkit.GetPageCount();
auto jArray = (jobjectArray) env->NewObjectArray(
count, env->FindClass("java/lang/String"), env->NewStringUTF(""));
...
What happens if you change the order of calls:
... vrv::Toolkit toolkit(false); toolkit.SetResourcePath(resourcePath); toolkit.ResetOptions(); // not really necessary because you've just initialized, but OK toolkit.LoadFile(inputFilePath); toolkit.SetOptions(optionJson); int count = toolkit.GetPageCount(); auto jArray = (jobjectArray) env->NewObjectArray( count, env->FindClass("java/lang/String"), env->NewStringUTF("")); ...
thanks ,the problem has been solved
Describe the problem With the same version and option, why do I get different results on Android and Mac. The music score rendered on the mac will reduce the number of bars in each line with the "pageWidth" parameter, but not on android. I have tried to modify many "option", which can't achieve the effect。I've tried many other versions, but none of them works。Are there any configuration options I don't know?
Expected behavior I expect the results of running on Android will be the same as those on the Mac
Input data xml/musicxml
*Verovio information
Environment information (as appropriate)
This is the screenshot on android
This is the music score rendered by mac CMD : verovio xxxxxxxx.musicxml -p 1 --page-width 1080 --page-height 1920
Additional context