Skip to content

Commit

Permalink
Fix text width crop (#68)
Browse files Browse the repository at this point in the history
* fix text width, bump ver

* lint
  • Loading branch information
royshil committed Dec 21, 2023
1 parent 445dea2 commit 561e9c0
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 4 deletions.
4 changes: 2 additions & 2 deletions buildspec.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@
}
},
"name": "obs-urlsource",
"version": "0.2.5",
"version": "0.2.6",
"author": "Roy Shilkrot",
"website": "https://github.com/royshil/obs-urlsource",
"website": "https://github.com/occ-ai/obs-urlsource",
"email": "[email protected]",
"uuids": {
"macosPackage": "0FFFBEF3-66A8-4288-8FFA-25818CE61EF1",
Expand Down
2 changes: 0 additions & 2 deletions src/ui/text-render-helper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,6 @@ void render_text_with_qtextdocument(const std::string &text, uint32_t &width, ui

// save pixmap to buffer
QImage image = pixmap.toImage();
// crop to the idealWidth of the text
image = image.copy(0, 0, (int)textDocument.idealWidth(), image.height());
// get width and height
width = image.width();
height = image.height();
Expand Down
6 changes: 6 additions & 0 deletions src/url-source.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -642,6 +642,12 @@ obs_properties_t *url_source_properties(void *data)

obs_properties_add_int(ppts, "render_width", "Render Width (px)", 100, 10000, 1);

// Add a informative text about the plugin
obs_properties_add_text(
ppts, "info",
QString(PLUGIN_INFO_TEMPLATE).arg(PLUGIN_VERSION).toStdString().c_str(),
OBS_TEXT_INFO);

return ppts;
}

Expand Down
5 changes: 5 additions & 0 deletions src/url-source.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@ const char *url_source_name(void *unused);
void url_source_activate(void *data);
void url_source_deactivate(void *data);

const char *const PLUGIN_INFO_TEMPLATE =
"<a href=\"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/occ-ai/obs-urlsource/\">URL/API Source</a> (%1) by "
"<a href=\"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/occ-ai\">OCC AI</a> ❤️ "
"<a href=\"https://www.patreon.com/RoyShilkrot\">Support & Follow</a>";

#ifdef __cplusplus
}
#endif
Expand Down

0 comments on commit 561e9c0

Please sign in to comment.