Coder Social home page Coder Social logo

Comments (3)

TylerLeonhardt avatar TylerLeonhardt commented on June 5, 2024 1

This seems to really just be the container... not Jupyter Notebooks specifically.

from pswordcloud.

vexx32 avatar vexx32 commented on June 5, 2024

After installing v3.0.1 and showing the debug messages, it looks like the cmdlet is hanging somewhere in this block of code:

WriteDebug($"Adding focus word '{FocusWord}' to the dictionary.");
wordScaleDictionary[FocusWord] = highestWordFreq *= FOCUS_WORD_SCALE;
}
sortedWordList = new List<string>(SortWordList(wordScaleDictionary, MaxRenderedWords));
try
{
if (MyInvocation.BoundParameters.ContainsKey(nameof(BackgroundImage)))
{
WriteDebug($"Importing background image from '{_backgroundFullPath}'.");
backgroundImage = SKBitmap.Decode(_backgroundFullPath);
drawableBounds = new SKRectI(0, 0, backgroundImage.Width, backgroundImage.Height);
}
else
{
drawableBounds = new SKRectI(0, 0, ImageSize.Width, ImageSize.Height);
}
wordPath = new SKPath();
clipRegion = new SKRegion();
clipRegion.SetRect(SKRectI.Round(drawableBounds));
_fontScale = FontScale(
clipRegion.Bounds,
WordScale,
wordScaleDictionary.Values.Average(),
Math.Min(wordScaleDictionary.Count, MaxRenderedWords),
Typeface);
scaledWordSizes = new Dictionary<string, float>(
sortedWordList.Count,
StringComparer.OrdinalIgnoreCase);
maxWordWidth = AllowRotation == WordOrientations.None
? drawableBounds.Width * MAX_WORD_WIDTH_PERCENT
: Math.Max(drawableBounds.Width, drawableBounds.Height) * MAX_WORD_WIDTH_PERCENT;
using SKPaint brush = new SKPaint
{
Typeface = Typeface
};
SKRect rect = SKRect.Empty;
float adjustedWordSize;
bool retry;
do
{
// Pre-test and adjust global scale based on the largest word.
retry = false;
adjustedWordSize = ScaleWordSize(
wordScaleDictionary[sortedWordList[0]],
_fontScale,
wordScaleDictionary);
brush.NextWord(adjustedWordSize, StrokeWidth);
var textRect = brush.GetTextPath(sortedWordList[0], 0, 0).ComputeTightBounds();
var adjustedTextWidth = textRect.Width * (1 + _paddingMultiplier) + StrokeWidth * 2 * STROKE_BASE_SCALE;
if (adjustedTextWidth > maxWordWidth
|| textRect.Width * textRect.Height < drawableBounds.Width * drawableBounds.Height * MAX_WORD_AREA_PERCENT)
{
retry = true;
_fontScale *= 1.05f;
}
} while (retry);
// Apply manual scaling from the user
_fontScale *= WordScale;
WriteDebug($"Global font scale: {_fontScale}");

(The first WriteDebug() call shows, the second is never reached.)

from pswordcloud.

vexx32 avatar vexx32 commented on June 5, 2024

I suspect the issue is the SKRegion object as allocating the memory for that is most likely to be the one that causes issues. However, SKRect has been a problem point in the past, so all bets are really off.

As far as I can tell, it seems like it's hanging somewhere on the native library calls used by SkiaSharp, and I don't know nearly enough to understand why.

I'm reasonably confident it's not something I can fix, but it's possible we might find a workaround sooner or later.

from pswordcloud.

Related Issues (20)

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.